This file contains hidden or 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 <bits/stdc++.h> | |
using namespace std; | |
typedef long long LL; | |
const int maxn = 1000005; | |
int seg[maxn*2-1]; | |
int n; | |
void init(int N) { | |
n = 1; |
This file contains hidden or 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 <bits/stdc++.h> | |
#define idx first | |
#define h second | |
using namespace std; | |
typedef unsigned UINT; | |
typedef pair<int,UINT> PIU; | |
int n, m; |
This file contains hidden or 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 <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
const int maxn = 100010; | |
int a[maxn]; | |
bool cmp(int a, int b) { | |
return b < a; | |
} | |
int main() { | |
int T; |
This file contains hidden or 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 <bits/stdc++.h> | |
using namespace std; | |
int n, t, c[5], a[5], b[5]; | |
queue<int> Q; | |
set<int> S; //Hash Table | |
int Hash() { | |
int h = 0; | |
for(int i = 0; i < n; i++) { |
This file contains hidden or 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 <cstdio> | |
typedef long long ll; | |
int main(){ | |
ll a, b; | |
while(scanf("%lld%lld",&a,&b)==2&&a+b){ | |
if(b<a){ll t=a;a=b;b=t;} | |
printf("%lld\n",(a*(a+1)*(2*a+1)/6)+(b-a)*(a*(a+1)/2)); | |
} | |
return 0; | |
} |
This file contains hidden or 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 <cstdio> | |
#include <cmath> | |
const double eps = 1e-5; | |
double f(double x) { | |
return pow(2, abs(x)); | |
} | |
double trinary_search(double l, double r) { | |
double t1,t2,a1,a2; |
This file contains hidden or 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 <bits/stdc++.h> | |
using namespace std; | |
typedef long long LL; | |
const int maxn = 102; | |
struct P { | |
int r, c; | |
P() {} | |
P(int R, int C):r(R), c(C){} | |
}; |
This file contains hidden or 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 <bits/stdc++.h> | |
using namespace std; | |
typedef long long LL; | |
const int maxn = 1000005; | |
int a[maxn],f[maxn]; | |
int main() { | |
int T, n; | |
scanf("%d", &T); | |
while(T--) { | |
scanf("%d", &n); |
This file contains hidden or 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 <bits/stdc++.h> | |
using namespace std; | |
int main() { | |
int n, m; | |
while(scanf("%d%d", &n, &m)==2) { | |
bool flag = true; | |
int a, b; | |
set<int> M[10001]; | |
vector<int> W[10001]; |
This file contains hidden or 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 <cstdio> | |
struct Tp { | |
int h,m,s; | |
bool operator < (const Tp& x)const{ | |
if(h==x.h){ | |
if(m==x.m)return s<x.s; | |
else return m<x.m; | |
}else return h<x.h; | |
} | |
Tp operator - (const Tp& x){ |