View gist:1673352
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
#define MAXN 10000010 | |
int gcd(int a, int b) { return a ? gcd(b % a, a) : b; } |
View gist:1732995
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From dalvik/vm/native/dalvik_system_Zygote.c | |
/* | |
* Calls POSIX setgroups() using the int[] object as an argument. | |
* A NULL argument is tolerated. | |
*/ | |
static int setgroupsIntarray(ArrayObject* gidArray) | |
{ | |
gid_t *gids; |
View gist:1841749
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <cmath> | |
using namespace std; | |
int X1[3]; | |
int X2[3]; | |
int Y1[3]; |
View gist:1841762
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<cmath> | |
#include<stdio.h> | |
#define fr(i,a,b) for(i=a;i<=b;i++) | |
using namespace std; | |
const int maxn=1002; | |
const double pi=acos(-1.0); | |
const double limit=1e8; | |
const double zero=1e-10; | |
double s[maxn]; |
View gist:1866535
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<vector> | |
#define fr(i,a,b) for(i=a;i<=b;i++) | |
using namespace std; | |
long long a,m,p,q,r,s,ans,pw[100],i,ca=0,now,tot; | |
vector<long long> len,len2; | |
vector<char> ty,ty2; | |
long long atleast(long long value){ | |
if(value<=0) | |
return 0; |
View gist:3356863
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <cstring> | |
#include <algorithm> | |
using namespace std; | |
int X[10010]; | |
int Y[10010]; | |
vector<int> XS[10010]; |
View gist:4029362
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <cstring> | |
#include <vector> | |
#include <cmath> | |
using namespace std; | |
double find(long long a, long long b, long long c, long long &d){ | |
if(!b||!c)return -1; | |
d=ceil((double) a* (double) c /(double) b); | |
if(d>100000)return -1; |
View gist:4036717
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <map> | |
#include <cstring> | |
#include <cstdio> | |
#include <utility> | |
using namespace std; | |
template<class T> struct splnode { | |
splnode() : V(0), P(NULL) { C[0] = C[1] = NULL; fix(); } |
View linkcut.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <cstdio> | |
#include <cstring> | |
#include <cassert> | |
using namespace std; | |
template<class T> struct splnode { | |
typedef splnode<T> node_t; |
View gist:4242182
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector<vector<int> > bounded_rsk(const vector<int>& A, int k) { | |
vector<vector<int> > h(k); | |
for(int i = 0; i < A.size(); i++) { | |
int x = A[i]; | |
for(int j = 0; j < k; j++) { | |
int p = lower_bound(h[j].begin(), h[j].end(), x) - h[j].begin(); | |
if(p == h[j].size()) { | |
h[j].push_back(x); | |
break; | |
} else { |
OlderNewer