├── 100109 ├── E.cpp ├── F.cpp ├── G.cpp ├── H.cpp ├── J.cpp ├── K.cpp ├── L.cpp ├── a (Akshay Jaggi's conflicted copy 2015-09-05).out ├── a.out ├── a.out.dSYM │ └── Contents │ │ ├── Info.plist │ │ └── Resources │ │ └── DWARF │ │ └── a.out ├── input (Akshay Jaggi's conflicted copy 2015-09-05).txt ├── input.txt ├── input.txt2 ├── input.txt3 ├── output (Akshay Jaggi's conflicted copy 2015-09-05).txt └── output.txt ├── 100134 ├── 1 ├── .A.cpp.swp ├── A.cpp ├── B.cpp ├── C.cpp ├── E.cpp ├── E_cp.cpp ├── Ein1 ├── Ein2 ├── Ein3 ├── G.cpp ├── H.cpp ├── I.cpp ├── J.cpp ├── L.cpp ├── a.out ├── caravan.out ├── exact.in ├── exact.out ├── in ├── in1 ├── in2 ├── in3 ├── myE.cpp └── try.cpp ├── 100253 ├── .G.cpp.swp ├── B.cpp ├── C.cpp ├── D.cpp ├── E ├── F.cpp ├── G.cpp ├── H.cpp ├── I.cpp ├── J.cpp ├── J_X.cpp ├── K.cpp ├── L.cpp ├── M.cpp ├── a (Karan Aggarwal's conflicted copy 2015-12-16).out ├── a.out ├── dp.cpp ├── in ├── in2 ├── in3 ├── inJ ├── inJ2 ├── inJ3 ├── new.cpp ├── om └── try.cpp ├── 100283 ├── .G.cpp (Karan Aggarwal's conflicted copy 2015-12-13).swp ├── .J.cpp (Lalit Kundu's conflicted copy 2015-12-13).swp ├── A.cpp ├── B.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── F.cpp ├── G.cpp ├── I.cpp ├── J.cpp ├── K.cpp ├── L.cpp ├── L_cp.cpp ├── a (Karan Aggarwal's conflicted copy 2015-12-13).out ├── a (Lalit Kundu's conflicted copy 2015-12-13).out ├── a.out ├── in ├── inC ├── myJ.cpp └── treasures.in ├── 100342 ├── A.cpp ├── A_old.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── F.cpp ├── G.cpp ├── H.cpp ├── I.cpp ├── J.cpp ├── a.out ├── e ├── in └── in2 ├── 100443 ├── 1 ├── B.cpp ├── C.cpp ├── D.cpp ├── F.cpp ├── Fnew.cpp ├── G.cpp ├── G_back.cpp ├── I.cpp ├── TeamNotebookFreezeVersion3.pdf ├── \ ├── a.out ├── brute.cpp ├── cori ├── e ├── gen.cpp ├── in ├── in1 ├── in2 ├── inG ├── ind ├── ind1 ├── ini ├── karan.cpp ├── myi ├── new.cpp └── test.cpp ├── 100517 ├── .H.cpp (Akshay Jaggi's conflicted copy 2015-12-09).swp ├── B.cpp ├── H.cpp ├── H_c.cpp ├── I.cpp ├── J.cpp ├── K.out ├── K.out.dSYM │ └── Contents │ │ ├── Info.plist │ │ └── Resources │ │ └── DWARF │ │ └── K.out ├── K_Akshay.cpp ├── K_in ├── K_kundu.cpp ├── K_out1 ├── K_out2 ├── L.cpp ├── L_Akshay.cpp ├── L_cp.cpp ├── a (Karan Aggarwal's conflicted copy 2015-12-09).out ├── a.out ├── in ├── inL ├── inL2 ├── out ├── out1 └── out2 ├── 100540 ├── .F.cpp (Karan Aggarwal's conflicted copy 2015-12-13).swp ├── A.cpp ├── B.cpp ├── C.cpp ├── D.cpp ├── Dbrute.cpp ├── E.cpp ├── F.cpp ├── F_Akshay.cpp ├── H.cpp ├── I.cpp ├── J.cpp ├── K.cpp ├── \ ├── a.out ├── cor ├── cor.cpp ├── cor1 ├── gen.cpp ├── in ├── in1 ├── inB ├── inF2 ├── inh ├── my ├── my1 └── rand ├── 100609 ├── 1 ├── A.cpp ├── B.cpp ├── C.cpp ├── D.cpp ├── F.cpp ├── G.cpp ├── H.cpp ├── H.cpp~ ├── I.cpp ├── J.cpp ├── K.cpp ├── a (Akshay Jaggi's conflicted copy 2015-12-14).out ├── a.out ├── gen.py ├── hull.cpp ├── in ├── in1 ├── in2 ├── in3 ├── inG ├── inG2 └── out ├── 100610 ├── A.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── F.cpp ├── G (Karan Aggarwal's conflicted copy 2016-01-19).cpp ├── G.cpp ├── H.cpp ├── I.cpp ├── J.cpp ├── K.cpp ├── a (Karan Aggarwal's conflicted copy 2016-01-19).out ├── a.out ├── acm.in ├── acm.out ├── code.py ├── defense.out ├── in ├── in2 ├── in_w ├── journey.out ├── kitchen.out ├── my ├── out └── out1 ├── 100622 ├── A.cpp ├── B.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── H.cpp ├── I.cpp ├── J.cpp ├── K.cpp ├── a.out ├── auxiliary.out ├── in ├── inC ├── inC1 ├── inK ├── ini ├── ini (Case Conflict) ├── kripke.out ├── my ├── out ├── try.cpp └── try.py ├── 100624 ├── A.cpp ├── D.cpp ├── J.cpp ├── J_k.cpp ├── a.out ├── geo.cpp └── in ├── 100676 ├── F.cpp ├── G.cpp ├── H.cpp ├── a.out └── in ├── 100685 ├── A.cpp ├── C.cpp ├── E.cpp ├── F.cpp ├── G.cpp ├── I.cpp ├── J.cpp └── K.cpp ├── 100729 ├── A.cpp ├── B.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── F.cpp ├── G.cpp ├── H.cpp ├── Hnew.cpp ├── I.cpp ├── a.out ├── cor ├── flow.cpp ├── in ├── in2 ├── inG ├── my └── spoj.cpp ├── 100733 ├── A.cpp ├── B.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── F.cpp ├── G.cpp ├── H.cpp ├── I.cpp └── J.cpp ├── 100735 ├── A.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── G.cpp ├── H.cpp ├── I.cpp ├── a.out ├── in └── in2 ├── 100739 ├── A.cpp ├── B.cpp ├── D.cpp ├── J.cpp ├── a.out ├── in └── in2 ├── 100741 ├── A.cpp ├── B.cpp ├── D.cpp ├── E.cpp ├── G.cpp ├── H.cpp ├── H_test.cpp ├── L.cpp ├── a.out ├── a.out.dSYM │ └── Contents │ │ ├── Info.plist │ │ └── Resources │ │ └── DWARF │ │ └── a.out └── in ├── 100765 ├── A.cpp ├── B.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── F.cpp ├── G.cpp └── I.cpp ├── 100781 ├── A.cpp ├── B.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── F.cpp ├── G.cpp ├── H.cpp └── J.cpp ├── 100792 ├── A.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── G.cpp ├── H.cpp ├── I.cpp └── K.cpp ├── 100796 ├── A.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── G.cpp ├── H.cpp ├── I.cpp ├── K.cpp └── L.cpp ├── 100800 ├── A.cpp ├── B.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── G.cpp ├── H.cpp ├── I.cpp └── J.cpp ├── 100801 ├── A.cpp ├── B.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── G.cpp ├── H.cpp ├── J.cpp └── L.cpp ├── 100803 ├── A.cpp ├── C.cpp ├── D.cpp ├── F.cpp ├── G.cpp └── I.cpp ├── 100812 ├── B.cpp ├── D.cpp ├── E.cpp ├── F.cpp ├── G.cpp ├── I.cpp ├── J.cpp ├── K.cpp └── L.cpp ├── 100818 ├── A.cpp ├── B.cpp ├── C.cpp ├── E.cpp ├── F.cpp ├── H.cpp └── I.cpp ├── 100827 ├── A.cpp ├── D.cpp ├── E.cpp ├── F.cpp ├── G.cpp ├── H.cpp ├── I.cpp ├── J.cpp └── L.cpp ├── 100837 ├── A.cpp ├── B.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── F.cpp ├── G.cpp ├── a.out ├── d.in ├── d.out ├── e.out ├── g.in ├── g.out ├── new.cpp └── try.cpp ├── 100851 ├── 1 ├── .c.cpp (Case Conflict).swp ├── A.cpp ├── C.cpp ├── D.cpp ├── E ├── E.cpp ├── F.cpp ├── G.cpp ├── J.cpp ├── K.cpp ├── L.cpp ├── a.out ├── brute.py ├── code.cpp ├── cor ├── in ├── in1 ├── in2 ├── in3 ├── in4 ├── in5 ├── my └── out ├── 100860 ├── A.cpp ├── B.cpp ├── C.cpp ├── F.cpp ├── G.cpp ├── H.cpp ├── J.cpp ├── K.cpp ├── a.out ├── i └── in ├── 100863 ├── 1 ├── A.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── F.cpp ├── G.cpp ├── I.cpp ├── J.cpp ├── a.out ├── code.py ├── in ├── in1 ├── je.cpp ├── myD.cpp ├── newE.cpp └── out ├── 100866 ├── A.cpp ├── B.cpp ├── C.cpp ├── D.cpp ├── E.cpp ├── F.cpp ├── I.cpp ├── J.cpp ├── a.out ├── in ├── inj ├── inj (Case Conflict) ├── newF.cpp └── oldC.cpp └── README.md /100109/J.cpp: -------------------------------------------------------------------------------- 1 | // karanaggarwal 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | using namespace std; 13 | 14 | #define TRACE 15 | #ifdef TRACE 16 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 17 | template 18 | void __f(const char* name, Arg1&& arg1){ 19 | cerr << name << " : " << arg1 << std::endl; 20 | } 21 | template 22 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 23 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 24 | } 25 | #else 26 | #define trace(...) 27 | #endif 28 | 29 | #define si(x) scanf("%d",&x) 30 | #define F first 31 | #define S second 32 | #define PB push_back 33 | #define MP make_pair 34 | 35 | 36 | typedef long long LL; 37 | typedef pair PII; 38 | typedef vector VI; 39 | typedef vector VPII; 40 | 41 | FILE *fin = freopen("input.txt","r",stdin); 42 | FILE *fout = freopen("output.txt","w",stdout); 43 | 44 | queue A[3]; 45 | int C[3]; 46 | int N[3]; 47 | string S; 48 | 49 | int main() 50 | { 51 | int n; 52 | cin>>n>>N[0]>>N[1]; N[2] = n - (N[0] + N[1]); 53 | if(N[2]<0){ 54 | cout<<-1<>S; 56 | for(int i=0; iN[i] and C[j] 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | #define TRACE 14 | #ifdef TRACE 15 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 16 | template 17 | void __f(const char* name, Arg1&& arg1){ 18 | cerr << name << " : " << arg1 << std::endl; 19 | } 20 | template 21 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 22 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 23 | } 24 | #else 25 | #define trace(...) 26 | #endif 27 | 28 | #define si(x) scanf("%d",&x) 29 | #define F first 30 | #define S second 31 | #define PB push_back 32 | #define MP make_pair 33 | 34 | 35 | typedef long long LL; 36 | typedef pair PII; 37 | typedef vector VI; 38 | typedef vector VPII; 39 | 40 | int T[2]; 41 | int C[2]; 42 | 43 | FILE *fin = freopen("input.txt","r",stdin); 44 | FILE *fout = freopen("output.txt","w",stdout); 45 | 46 | int main() 47 | { 48 | int n; 49 | cin>>n>>T[0]>>T[1]; 50 | while(1) 51 | { 52 | if(C[0]*T[0] == C[1]*T[1]) 53 | { 54 | if(C[0] + C[1] >=n)break; 55 | C[0]++; C[1]++; 56 | } 57 | else if( C[0]*T[0] < C[1]*T[1]) 58 | { 59 | if( C[0] + (C[0]*T[0]) / T[1] >=n)break; 60 | C[0]++; 61 | } 62 | else 63 | { 64 | if( C[1] + (C[1]*T[1]) / T[0] >=n)break; 65 | C[1]++; 66 | } 67 | } 68 | cout< 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleIdentifier 8 | com.apple.xcode.dsym.a.out 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | dSYM 13 | CFBundleSignature 14 | ???? 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleVersion 18 | 1 19 | 20 | 21 | -------------------------------------------------------------------------------- /100109/a.out.dSYM/Contents/Resources/DWARF/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100109/a.out.dSYM/Contents/Resources/DWARF/a.out -------------------------------------------------------------------------------- /100109/input (Akshay Jaggi's conflicted copy 2015-09-05).txt: -------------------------------------------------------------------------------- 1 | 10 2 | d 1 3 | d 2 4 | d 4 5 | d 3 6 | p 5 7 | d 1 8 | p 3 9 | p 3 10 | p 2 11 | -------------------------------------------------------------------------------- /100109/input.txt: -------------------------------------------------------------------------------- 1 | 5 2 1 2 | 5 3 3 | 4 2 4 | 6 4 5 | 3 2 6 | 2 2 7 | -------------------------------------------------------------------------------- /100109/input.txt2: -------------------------------------------------------------------------------- 1 | 6 2 | d 10 3 | d 12 4 | p 2 5 | d 1 6 | p 2 7 | -------------------------------------------------------------------------------- /100109/input.txt3: -------------------------------------------------------------------------------- 1 | 10 2 | d 1 3 | d 2 4 | d 3 5 | p 1 6 | d 20 7 | p 4 8 | d 15 9 | p 2 10 | p 1 11 | 12 | -------------------------------------------------------------------------------- /100109/output (Akshay Jaggi's conflicted copy 2015-09-05).txt: -------------------------------------------------------------------------------- 1 | 7 2 | 2 3 | 4 5 4 | -------------------------------------------------------------------------------- /100109/output.txt: -------------------------------------------------------------------------------- 1 | 2 5 2 | TT 3 | -------------------------------------------------------------------------------- /100134/.A.cpp.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100134/.A.cpp.swp -------------------------------------------------------------------------------- /100134/1: -------------------------------------------------------------------------------- 1 | myE.cpp: In function ‘int main()’: 2 | myE.cpp:77:43: error: ‘__gnu_cxx::__alloc_traits > >::value_type’ has no member named ‘size’ 3 | if(cur>=req or j>=(LL)m[i][j].size())break; 4 | ^ 5 | -------------------------------------------------------------------------------- /100134/Ein1: -------------------------------------------------------------------------------- 1 | 289 4 2 | 2 3 3 | 1 5 4 | 1 8 5 | 0 30 6 | -------------------------------------------------------------------------------- /100134/Ein2: -------------------------------------------------------------------------------- 1 | 300 4 2 | 2 3 3 | 1 5 4 | 1 7 5 | 0 30 6 | -------------------------------------------------------------------------------- /100134/Ein3: -------------------------------------------------------------------------------- 1 | 201 1 2 | 2 3 3 | -------------------------------------------------------------------------------- /100134/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100134/a.out -------------------------------------------------------------------------------- /100134/caravan.out: -------------------------------------------------------------------------------- 1 | 0/1 2 | -------------------------------------------------------------------------------- /100134/exact.in: -------------------------------------------------------------------------------- 1 | 201 1 2 | 2 3 3 | -------------------------------------------------------------------------------- /100134/exact.out: -------------------------------------------------------------------------------- 1 | -1 2 | -------------------------------------------------------------------------------- /100134/in: -------------------------------------------------------------------------------- 1 | 13 14 2 | ......#...#.. 3 | ....#........ 4 | .#..#...#.... 5 | .#..#........ 6 | .#..#..####.. 7 | ..........##. 8 | ........#.#.. 9 | #...........# 10 | ..#.#.#.#.... 11 | .##.#...#...# 12 | ......#.##... 13 | #.#.#.#...... 14 | .....#...#... 15 | .##.....##... 16 | -------------------------------------------------------------------------------- /100134/in1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100134/in1 -------------------------------------------------------------------------------- /100134/in2: -------------------------------------------------------------------------------- 1 | 3 3 2 | .#. 3 | ... 4 | .#. 5 | -------------------------------------------------------------------------------- /100134/in3: -------------------------------------------------------------------------------- 1 | 5 5 2 | ..... 3 | .#... 4 | ..... 5 | ..... 6 | .#... 7 | -------------------------------------------------------------------------------- /100134/try.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define assn(n,a,b) assert(n<=b and n>=a) 3 | #define pb push_back 4 | #define mp make_pair 5 | #define PB push_back 6 | #define MP make_pair 7 | #define F first 8 | #define S second 9 | #define SZ(a) (int)(a.size()) 10 | #define SET(a,b) memset(a,b,sizeof(a)) 11 | #define LET(x,a) __typeof(a) x(a) 12 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 13 | #define repi(i,n) for(int i=0; i<(int)n;i++) 14 | #define sd(n) scanf("%d",&n) 15 | #define si(n) scanf("%d",&n) 16 | #define sl(n) scanf("%lld",&n) 17 | #define sortv(a) sort(a.begin(),a.end()) 18 | #define all(a) a.begin(),a.end() 19 | using namespace std; 20 | 21 | #define TRACE 22 | #ifdef TRACE 23 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 24 | template 25 | void __f(const char* name, Arg1&& arg1){ 26 | cerr << name << " : " << arg1 << std::endl; 27 | } 28 | template 29 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 30 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 31 | } 32 | #else 33 | #define trace(...) 34 | #endif 35 | 36 | typedef long long LL; 37 | typedef pair PII; 38 | typedef vector VI; 39 | typedef vector< PII > VPII; 40 | 41 | #define MOD 1000000007ll 42 | LL mpow(LL a, LL n) 43 | {LL ret=1;LL b=a;while(n) {if(n&1) 44 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 45 | return (LL)ret;} 46 | 47 | //FILE *fin = freopen("in","r",stdin); 48 | //FILE *fout = freopen("out","w",stdout); 49 | 50 | int main() 51 | { 52 | string a(1e19, 'a'); 53 | cout << a << endl; 54 | return 0; 55 | } 56 | 57 | 58 | -------------------------------------------------------------------------------- /100253/.G.cpp.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100253/.G.cpp.swp -------------------------------------------------------------------------------- /100253/E: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100253/E -------------------------------------------------------------------------------- /100253/L.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define si(x) scanf("%d",&x) 4 | #define F first 5 | #define S second 6 | #define PB push_back 7 | #define MP make_pair 8 | 9 | int A[100001]; 10 | 11 | int main() 12 | { 13 | int n,d,a,b; 14 | cin>>n>>d>>a>>b; 15 | for(int i =0; iA[i-1]) 26 | { 27 | ci++; cd = 0; 28 | int can_buy = ci * a; 29 | can_buy = min(can_buy, d/A[i]); 30 | ans+=can_buy; 31 | d-= can_buy * A[i]; 32 | } 33 | else 34 | { 35 | cd++; ci =0; 36 | int can_buy = cd * b; 37 | can_buy = min(can_buy, ans); 38 | ans-=can_buy; 39 | d += can_buy * A[i]; 40 | } 41 | } 42 | cout< 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #define assn(n,a,b) assert(n<=b and n>=a) 16 | #define pb push_back 17 | #define mp make_pair 18 | #define PB push_back 19 | #define MP make_pair 20 | #define F first 21 | #define S second 22 | #define SZ(a) (int)(a.size()) 23 | #define SET(a,b) memset(a,b,sizeof(a)) 24 | #define LET(x,a) __typeof(a) x(a) 25 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 26 | #define repi(i,n) for(int i=0; i<(int)n;i++) 27 | #define sd(n) scanf("%d",&n) 28 | #define si(n) scanf("%d",&n) 29 | #define sl(n) scanf("%lld",&n) 30 | #define sortv(a) sort(a.begin(),a.end()) 31 | #define all(a) a.begin(),a.end() 32 | using namespace std; 33 | 34 | #define TRACE 35 | #ifdef TRACE 36 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 37 | template 38 | void __f(const char* name, Arg1&& arg1){ 39 | cerr << name << " : " << arg1 << std::endl; 40 | } 41 | template 42 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 43 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 44 | } 45 | #else 46 | #define trace(...) 47 | #endif 48 | 49 | typedef long long LL; 50 | typedef pair PII; 51 | typedef vector VI; 52 | typedef vector< PII > VPII; 53 | 54 | #define MOD 1000000007ll 55 | LL mpow(LL a, LL n) 56 | {LL ret=1;LL b=a;while(n) {if(n&1) 57 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 58 | return (LL)ret;} 59 | 60 | #ifdef ONLINE_JUDGE 61 | //FILE *fin = freopen(stdin,"r",stdin); 62 | //FILE *fout = freopen(stdout,"w",stdout); 63 | #endif 64 | 65 | int main() 66 | { 67 | //ios_base::sync_with_stdio(false); 68 | return 0; 69 | } 70 | 71 | 72 | -------------------------------------------------------------------------------- /100253/om: -------------------------------------------------------------------------------- 1 | 3 3 2 | 1 2 3 | 2 3 4 | 1 3 5 | 3 3 6 | 1 2 7 | 2 1 8 | 1 3 9 | 3 6 10 | 1 2 11 | 2 1 12 | 1 3 13 | 3 1 14 | 3 2 15 | 2 3 16 | -------------------------------------------------------------------------------- /100283/.G.cpp (Karan Aggarwal's conflicted copy 2015-12-13).swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100283/.G.cpp (Karan Aggarwal's conflicted copy 2015-12-13).swp -------------------------------------------------------------------------------- /100283/.J.cpp (Lalit Kundu's conflicted copy 2015-12-13).swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100283/.J.cpp (Lalit Kundu's conflicted copy 2015-12-13).swp -------------------------------------------------------------------------------- /100283/E.cpp: -------------------------------------------------------------------------------- 1 | // akshayjaggi 2 | 3 | #include 4 | 5 | using namespace std; 6 | 7 | #define TRACE 8 | #ifdef TRACE 9 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 10 | template 11 | void __f(const char* name, Arg1&& arg1){ 12 | cerr << name << " : " << arg1 << std::endl; 13 | } 14 | template 15 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 16 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 17 | } 18 | #else 19 | #define trace(...) 20 | #endif 21 | 22 | #define si(x) scanf("%d",&x) 23 | #define F first 24 | #define S second 25 | #define PB push_back 26 | #define MP make_pair 27 | 28 | 29 | typedef long long LL; 30 | typedef pair PII; 31 | typedef vector VI; 32 | typedef vector VPII; 33 | 34 | #ifdef ONLINE_JUDGE 35 | FILE *fin = freopen("ghanophobia.in","r",stdin); 36 | //FILE *fout = freopen("out","w",stdout); 37 | #endif 38 | 39 | int main() 40 | { 41 | //ios_base::sync_with_stdio(false); 42 | int T; 43 | si(T); 44 | for(int t=1; t<=T; t++) 45 | { 46 | int n,m; 47 | scanf("%d:%d", &n,&m); 48 | if(n+1 == m+6) 49 | { 50 | if(m==1) 51 | { 52 | printf("Case %d: PENALTIES\n",t); 53 | } 54 | else if(m>1) 55 | { 56 | printf("Case %d: NO\n",t); 57 | } 58 | else 59 | { 60 | printf("Case %d: YES\n",t); 61 | } 62 | } 63 | else if(n+1 > m+6) 64 | { 65 | printf("Case %d: YES\n",t); 66 | } 67 | else 68 | { 69 | printf("Case %d: NO\n",t); 70 | } 71 | } 72 | return 0; 73 | } 74 | 75 | -------------------------------------------------------------------------------- /100283/G.cpp: -------------------------------------------------------------------------------- 1 | 2 | //karanaggarwal 3 | #include 4 | using namespace std; 5 | 6 | #define TRACE 7 | #ifdef TRACE 8 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 9 | template 10 | void __f(const char* name, Arg1&& arg1){ 11 | cerr << name << " : " << arg1 << std::endl; 12 | } 13 | template 14 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 15 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 16 | } 17 | #else 18 | #define trace(...) 19 | #endif 20 | 21 | #define si(x) scanf("%d",&x) 22 | #define F first 23 | #define S second 24 | #define PB push_back 25 | #define MP make_pair 26 | 27 | typedef long long LL; 28 | typedef pair PII; 29 | typedef vector VI; 30 | typedef vector VPII; 31 | 32 | const int mod = 1000000007; 33 | inline void add(int &x, int y){x+=y; if(x>=mod)x-=mod; if(x<0)x+=mod;} 34 | inline int mul(int x, int y){ return ((LL)x * y)%mod;} 35 | int gcd(int a, int b){ if(b)return gcd(b,a%b); return a;} 36 | int power(int a ,int p){int ret = 1; while(p){if(p&1)ret=mul(ret,a); a=mul(a,a); p/=2;}return ret;} 37 | int phi(int n){ int ret=n; int i = 2; 38 | if(n%i==0){ ret-=ret/i; while(n%i==0)n/=i;} 39 | for(i=3; i*i<=n; i++)if(n%i==0){ ret-=ret/i; while(n%i==0)n/=i;} 40 | if(n>1)ret-=ret/n;return ret; 41 | } 42 | #ifdef ONLINE_JUDGE 43 | FILE *fin = freopen("jenga.in","r",stdin); 44 | #endif 45 | 46 | bool DP[3][100000]; 47 | int f(int N) 48 | { 49 | if(N<4)return 1; 50 | N-=4; 51 | N%=7; 52 | if(N<3)return 0; return 1; 53 | } 54 | int main() 55 | { 56 | int t; si(t); int T = t; while(t--) 57 | { 58 | printf("Case %d:",T-t); 59 | int N; si(N); 60 | if(f(N)) printf(" Bakkar\n"); else printf(" Wahdan\n"); 61 | } 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /100283/a (Karan Aggarwal's conflicted copy 2015-12-13).out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100283/a (Karan Aggarwal's conflicted copy 2015-12-13).out -------------------------------------------------------------------------------- /100283/a (Lalit Kundu's conflicted copy 2015-12-13).out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100283/a (Lalit Kundu's conflicted copy 2015-12-13).out -------------------------------------------------------------------------------- /100283/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100283/a.out -------------------------------------------------------------------------------- /100283/in: -------------------------------------------------------------------------------- 1 | 1 2 | 10 3 3 | 5.0 6.0 6.0 5.0 4.0 4 | 1.0 9.0 3.0 8.0 0.0 5 | 1.0 7.0 7.0 5.0 5.0 6 | 4.0 0.0 1.0 9.0 8.0 7 | 6.0 0.0 5.0 6.0 0.0 8 | 6.0 7.0 6.0 5.0 4.0 9 | 1.0 4.0 5.0 6.0 6.0 10 | 5.0 7.0 8.0 9.0 8.0 11 | 1.0 3.0 3.0 7.0 9.0 12 | 1.0 2.0 8.0 4.0 8.0 13 | 0.0 1.0 2 3.0 4 5.0 6.0 7.0 8.0 9.0 14 | 4.0 0.0 1.0 5 0.0 6.0 7.0 6 9.0 8.0 15 | 3.0 2.0 5 7.0 8.0 5.0 5.0 6 8.0 9.0 16 | -------------------------------------------------------------------------------- /100283/inC: -------------------------------------------------------------------------------- 1 | 1 2 | 3 3 2 3 2 3 | 1 2 3 4 | 4 5 6 5 | 7 8 9 6 | -------------------------------------------------------------------------------- /100283/treasures.in: -------------------------------------------------------------------------------- 1 | 1 2 | 3 3 3 3 2 3 | 1 2 3 4 | 4 5 6 5 | 7 8 9 6 | -------------------------------------------------------------------------------- /100342/J.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | FILE *fin = freopen("triatrip.in","r",stdin); 29 | FILE *fout = freopen("triatrip.out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | bitset<1500> G[1500]; 38 | bitset<1500> rG[1500]; 39 | 40 | int main() 41 | { 42 | int N; si(N); 43 | for(int i =0; i>s; for(int j=0; j > > > >’) 3 | if(n<0 or not it)break; 4 | ^ 5 | I.cpp:83:27: note: candidate is: 6 | I.cpp:83:27: note: operator!(bool) 7 | I.cpp:83:27: note: no known conversion for argument 1 from ‘std::reverse_iterator > > > >’ to ‘bool’ 8 | -------------------------------------------------------------------------------- /100443/G_back.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define assn(n,a,b) assert(n<=b and n>=a) 4 | #define pb push_back 5 | #define mp make_pair 6 | #define PB push_back 7 | #define MP make_pair 8 | #define F first 9 | #define S second 10 | #define SZ(a) (int)(a.size()) 11 | #define SET(a,b) memset(a,b,sizeof(a)) 12 | #define LET(x,a) __typeof(a) x(a) 13 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 14 | #define repi(i,n) for(int i=0; i<(int)n;i++) 15 | #define sd(n) scanf("%d",&n) 16 | #define si(n) scanf("%d",&n) 17 | #define sl(n) scanf("%lld",&n) 18 | #define sortv(a) sort(a.begin(),a.end()) 19 | #define all(a) a.begin(),a.end() 20 | using namespace std; 21 | 22 | #define TRACE 23 | #ifdef TRACE 24 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 25 | template 26 | void __f(const char* name, Arg1&& arg1){ 27 | cerr << name << " : " << arg1 << std::endl; 28 | } 29 | template 30 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 31 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 32 | } 33 | #else 34 | #define trace(...) 35 | #endif 36 | 37 | typedef long long LL; 38 | typedef pair PII; 39 | typedef vector VI; 40 | typedef vector< PII > VPII; 41 | int main() 42 | { 43 | return 0; 44 | } 45 | 46 | 47 | -------------------------------------------------------------------------------- /100443/TeamNotebookFreezeVersion3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100443/TeamNotebookFreezeVersion3.pdf -------------------------------------------------------------------------------- /100443/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100443/a.out -------------------------------------------------------------------------------- /100443/brute.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define assn(n,a,b) assert(n<=b and n>=a) 4 | #define pb push_back 5 | #define mp make_pair 6 | #define PB push_back 7 | #define MP make_pair 8 | #define F first 9 | #define S second 10 | #define SZ(a) (int)(a.size()) 11 | #define SET(a,b) memset(a,b,sizeof(a)) 12 | #define LET(x,a) __typeof(a) x(a) 13 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 14 | #define repi(i,n) for(int i=0; i<(int)n;i++) 15 | #define sd(n) scanf("%d",&n) 16 | #define si(n) scanf("%d",&n) 17 | #define sl(n) scanf("%lld",&n) 18 | #define sortv(a) sort(a.begin(),a.end()) 19 | #define all(a) a.begin(),a.end() 20 | using namespace std; 21 | 22 | #define TRACE 23 | #ifdef TRACE 24 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 25 | template 26 | void __f(const char* name, Arg1&& arg1){ 27 | cerr << name << " : " << arg1 << std::endl; 28 | } 29 | template 30 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 31 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 32 | } 33 | #else 34 | #define trace(...) 35 | #endif 36 | 37 | typedef long long LL; 38 | typedef pair PII; 39 | typedef vector VI; 40 | typedef vector< PII > VPII; 41 | 42 | #define MOD 1000000007ll 43 | LL mpow(LL a, LL n) 44 | {LL ret=1;LL b=a;while(n) {if(n&1) 45 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 46 | return (LL)ret;} 47 | 48 | #ifdef ONLINE_JUDGE 49 | //FILE *fin = freopen(stdin,"r",stdin); 50 | //FILE *fout = freopen(stdout,"w",stdout); 51 | #endif 52 | 53 | bool is_even(LL x) 54 | { 55 | LL ans = 0; 56 | while(x) 57 | { 58 | x/=5; ans+=x; 59 | } 60 | return ans%2==0; 61 | } 62 | 63 | 64 | 65 | 66 | int main() 67 | { 68 | 69 | int n; 70 | while(cin >> n) 71 | { 72 | int ans = 0; 73 | for(int i=0; i<=n; i++) 74 | if(is_even(i))ans++; 75 | cout << ans << endl; 76 | } 77 | return 0; 78 | } 79 | 80 | 81 | -------------------------------------------------------------------------------- /100443/cori: -------------------------------------------------------------------------------- 1 | 2 | analyzing 1 3 | appears 1 4 | business 1 5 | company 1 6 | consists 1 7 | date 1 8 | depending 1 9 | efficiency 1 10 | hired 1 11 | hiring 1 12 | imagine 1 13 | information 1 14 | main 1 15 | maintaining 1 16 | process 1 17 | program 1 18 | simple 1 19 | solution 1 20 | test 1 21 | that 1 22 | topics 1 23 | trending 1 24 | whose 1 25 | will 1 26 | writing 1 27 | your 1 28 | 29 | 30 | text 4 31 | corresponding 3 32 | file 2 33 | provide 2 34 | test 2 35 | words 2 36 | 37 | 38 | blah 9 39 | text 4 40 | corresponding 3 41 | please 3 42 | 43 | -------------------------------------------------------------------------------- /100443/gen.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define assn(n,a,b) assert(n<=b and n>=a) 4 | #define pb push_back 5 | #define mp make_pair 6 | #define PB push_back 7 | #define MP make_pair 8 | #define F first 9 | #define S second 10 | #define SZ(a) (int)(a.size()) 11 | #define SET(a,b) memset(a,b,sizeof(a)) 12 | #define LET(x,a) __typeof(a) x(a) 13 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 14 | #define repi(i,n) for(int i=0; i<(int)n;i++) 15 | #define sd(n) scanf("%d",&n) 16 | #define si(n) scanf("%d",&n) 17 | #define sl(n) scanf("%lld",&n) 18 | #define sortv(a) sort(a.begin(),a.end()) 19 | #define all(a) a.begin(),a.end() 20 | using namespace std; 21 | 22 | #define TRACE 23 | #ifdef TRACE 24 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 25 | template 26 | void __f(const char* name, Arg1&& arg1){ 27 | cerr << name << " : " << arg1 << std::endl; 28 | } 29 | template 30 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 31 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 32 | } 33 | #else 34 | #define trace(...) 35 | #endif 36 | 37 | typedef long long LL; 38 | typedef pair PII; 39 | typedef vector VI; 40 | typedef vector< PII > VPII; 41 | 42 | #define MOD 1000000007ll 43 | LL mpow(LL a, LL n) 44 | {LL ret=1;LL b=a;while(n) {if(n&1) 45 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 46 | return (LL)ret;} 47 | 48 | #ifdef ONLINE_JUDGE 49 | //FILE *fin = freopen(stdin,"r",stdin); 50 | //FILE *fout = freopen(stdout,"w",stdout); 51 | #endif 52 | 53 | int main() 54 | { 55 | //ios_base::sync_with_stdio(false); 56 | int q; 57 | string s; 58 | cin >> q >> s; 59 | int n=s.length(); 60 | for(int i=0; i 2 | abcd abce 3 | 4 | 5 | -------------------------------------------------------------------------------- /100443/in2: -------------------------------------------------------------------------------- 1 | 2 2 | 3 3 | 10 4 | 100 5 | 1000 6 | 2000 7 | 3000 8 | 10000 9 | 100000 10 | 200000 11 | -1 12 | -------------------------------------------------------------------------------- /100443/inG: -------------------------------------------------------------------------------- 1 | 8 2 | 1-2 3 | 3-1 4 | 4-5 5 | 4-8 6 | 1-7 7 | 1-4 8 | 7-1 9 | 2-4 10 | 1-8 11 | 6-7 12 | 2-3 13 | 1-5 14 | 1-6 15 | 7-6 16 | 7-8 17 | 2-5 18 | 7-1 19 | 3-4 20 | 5-6 21 | 7-8 22 | -------------------------------------------------------------------------------- /100443/ind: -------------------------------------------------------------------------------- 1 | 120 2 | 9 L 3 | 9 LL 4 | 9 LLR 5 | 9 LLRL 6 | 9 LLRLL 7 | 9 LLRLLR 8 | 9 LLRLLRR 9 | 9 LLRLLRRL 10 | 9 LLRLLRRLL 11 | 9 LLRLLRRLLL 12 | 9 LLRLLRRLLLR 13 | 9 LLRLLRRLLLRR 14 | 9 LLRLLRRLLLRRL 15 | 9 LLRLLRRLLLRRLR 16 | 9 LLRLLRRLLLRRLRR 17 | 9 L 18 | 9 LR 19 | 9 LRL 20 | 9 LRLL 21 | 9 LRLLR 22 | 9 LRLLRR 23 | 9 LRLLRRL 24 | 9 LRLLRRLL 25 | 9 LRLLRRLLL 26 | 9 LRLLRRLLLR 27 | 9 LRLLRRLLLRR 28 | 9 LRLLRRLLLRRL 29 | 9 LRLLRRLLLRRLR 30 | 9 LRLLRRLLLRRLRR 31 | 9 R 32 | 9 RL 33 | 9 RLL 34 | 9 RLLR 35 | 9 RLLRR 36 | 9 RLLRRL 37 | 9 RLLRRLL 38 | 9 RLLRRLLL 39 | 9 RLLRRLLLR 40 | 9 RLLRRLLLRR 41 | 9 RLLRRLLLRRL 42 | 9 RLLRRLLLRRLR 43 | 9 RLLRRLLLRRLRR 44 | 9 L 45 | 9 LL 46 | 9 LLR 47 | 9 LLRR 48 | 9 LLRRL 49 | 9 LLRRLL 50 | 9 LLRRLLL 51 | 9 LLRRLLLR 52 | 9 LLRRLLLRR 53 | 9 LLRRLLLRRL 54 | 9 LLRRLLLRRLR 55 | 9 LLRRLLLRRLRR 56 | 9 L 57 | 9 LR 58 | 9 LRR 59 | 9 LRRL 60 | 9 LRRLL 61 | 9 LRRLLL 62 | 9 LRRLLLR 63 | 9 LRRLLLRR 64 | 9 LRRLLLRRL 65 | 9 LRRLLLRRLR 66 | 9 LRRLLLRRLRR 67 | 9 R 68 | 9 RR 69 | 9 RRL 70 | 9 RRLL 71 | 9 RRLLL 72 | 9 RRLLLR 73 | 9 RRLLLRR 74 | 9 RRLLLRRL 75 | 9 RRLLLRRLR 76 | 9 RRLLLRRLRR 77 | 9 R 78 | 9 RL 79 | 9 RLL 80 | 9 RLLL 81 | 9 RLLLR 82 | 9 RLLLRR 83 | 9 RLLLRRL 84 | 9 RLLLRRLR 85 | 9 RLLLRRLRR 86 | 9 L 87 | 9 LL 88 | 9 LLL 89 | 9 LLLR 90 | 9 LLLRR 91 | 9 LLLRRL 92 | 9 LLLRRLR 93 | 9 LLLRRLRR 94 | 9 L 95 | 9 LL 96 | 9 LLR 97 | 9 LLRR 98 | 9 LLRRL 99 | 9 LLRRLR 100 | 9 LLRRLRR 101 | 9 L 102 | 9 LR 103 | 9 LRR 104 | 9 LRRL 105 | 9 LRRLR 106 | 9 LRRLRR 107 | 9 R 108 | 9 RR 109 | 9 RRL 110 | 9 RRLR 111 | 9 RRLRR 112 | 9 R 113 | 9 RL 114 | 9 RLR 115 | 9 RLRR 116 | 9 L 117 | 9 LR 118 | 9 LRR 119 | 9 R 120 | 9 RR 121 | 9 R 122 | -------------------------------------------------------------------------------- /100443/ind1: -------------------------------------------------------------------------------- 1 | 28 2 | 8 L 3 | 8 LL 4 | 8 LLR 5 | 8 LLRL 6 | 8 LLRLL 7 | 8 LLRLLR 8 | 8 LLRLLRR 9 | 8 L 10 | 8 LR 11 | 8 LRL 12 | 8 LRLL 13 | 8 LRLLR 14 | 8 LRLLRR 15 | 8 R 16 | 8 RL 17 | 8 RLL 18 | 8 RLLR 19 | 8 RLLRR 20 | 8 L 21 | 8 LL 22 | 8 LLR 23 | 8 LLRR 24 | 8 L 25 | 8 LR 26 | 8 LRR 27 | 8 R 28 | 8 RR 29 | 8 R 30 | -------------------------------------------------------------------------------- /100443/ini: -------------------------------------------------------------------------------- 1 | 2 | imagine you are in the hiring process of a company whose 3 | main business is analyzing the information that appears 4 | in the web 5 | 6 | 7 | a simple test consists in writing a program for 8 | maintaining up to date a set of trending topics 9 | 10 | 11 | you will be hired depending on the efficiency of your solution 12 | 13 | 14 | 15 | they provide you with a file containing the text 16 | corresponding to a highly active blog 17 | 18 | 19 | the text is organized daily and you have to provide the 20 | sorted list of the n most frequent words during last week 21 | when asked 22 | 23 | 24 | each input file contains one test case the text corresponding 25 | to a day is delimited by tag text 26 | 27 | 28 | the query of top n words can appear between texts corresponding 29 | to two different days 30 | 31 | 32 | 33 | blah blah blah blah blah blah blah blah blah 34 | please please please 35 | 36 | 37 | -------------------------------------------------------------------------------- /100443/myi: -------------------------------------------------------------------------------- 1 | 2 | analyzing 1 3 | appears 1 4 | business 1 5 | company 1 6 | consists 1 7 | date 1 8 | depending 1 9 | efficiency 1 10 | hired 1 11 | hiring 1 12 | imagine 1 13 | information 1 14 | main 1 15 | maintaining 1 16 | process 1 17 | program 1 18 | simple 1 19 | solution 1 20 | test 1 21 | that 1 22 | topics 1 23 | trending 1 24 | whose 1 25 | will 1 26 | writing 1 27 | your 1 28 | 29 | 30 | text 4 31 | corresponding 3 32 | file 2 33 | provide 2 34 | test 2 35 | words 2 36 | 37 | 38 | blah 9 39 | text 4 40 | corresponding 3 41 | please 3 42 | 43 | -------------------------------------------------------------------------------- /100443/new.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define assn(n,a,b) assert(n<=b and n>=a) 4 | #define pb push_back 5 | #define mp make_pair 6 | #define PB push_back 7 | #define MP make_pair 8 | #define F first 9 | #define S second 10 | #define SZ(a) (int)(a.size()) 11 | #define SET(a,b) memset(a,b,sizeof(a)) 12 | #define LET(x,a) __typeof(a) x(a) 13 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 14 | #define repi(i,n) for(int i=0; i<(int)n;i++) 15 | #define sd(n) scanf("%d",&n) 16 | #define si(n) scanf("%d",&n) 17 | #define sl(n) scanf("%lld",&n) 18 | #define sortv(a) sort(a.begin(),a.end()) 19 | #define all(a) a.begin(),a.end() 20 | using namespace std; 21 | 22 | #define TRACE 23 | #ifdef TRACE 24 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 25 | template 26 | void __f(const char* name, Arg1&& arg1){ 27 | cerr << name << " : " << arg1 << std::endl; 28 | } 29 | template 30 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 31 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 32 | } 33 | #else 34 | #define trace(...) 35 | #endif 36 | 37 | typedef long long LL; 38 | typedef pair PII; 39 | typedef vector VI; 40 | typedef vector< PII > VPII; 41 | 42 | #define MOD 1000000007ll 43 | LL mpow(LL a, LL n) 44 | {LL ret=1;LL b=a;while(n) {if(n&1) 45 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 46 | return (LL)ret;} 47 | 48 | #ifdef ONLINE_JUDGE 49 | //FILE *fin = freopen(stdin,"r",stdin); 50 | //FILE *fout = freopen(stdout,"w",stdout); 51 | #endif 52 | 53 | int main() 54 | { 55 | LL n; 56 | while(cin>>n) 57 | { 58 | 59 | } 60 | return 0; 61 | } 62 | 63 | 64 | -------------------------------------------------------------------------------- /100443/test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define assn(n,a,b) assert(n<=b and n>=a) 4 | #define pb push_back 5 | #define mp make_pair 6 | #define PB push_back 7 | #define MP make_pair 8 | #define F first 9 | #define S second 10 | #define SZ(a) (int)(a.size()) 11 | #define SET(a,b) memset(a,b,sizeof(a)) 12 | #define LET(x,a) __typeof(a) x(a) 13 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 14 | #define repi(i,n) for(int i=0; i<(int)n;i++) 15 | #define sd(n) scanf("%d",&n) 16 | #define si(n) scanf("%d",&n) 17 | #define sl(n) scanf("%lld",&n) 18 | #define sortv(a) sort(a.begin(),a.end()) 19 | #define all(a) a.begin(),a.end() 20 | using namespace std; 21 | 22 | #define TRACE 23 | #ifdef TRACE 24 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 25 | template 26 | void __f(const char* name, Arg1&& arg1){ 27 | cerr << name << " : " << arg1 << std::endl; 28 | } 29 | template 30 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 31 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 32 | } 33 | #else 34 | #define trace(...) 35 | #endif 36 | 37 | typedef long long LL; 38 | typedef pair PII; 39 | typedef vector VI; 40 | typedef vector< PII > VPII; 41 | 42 | #define MOD 1000000007ll 43 | LL mpow(LL a, LL n) 44 | {LL ret=1;LL b=a;while(n) {if(n&1) 45 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 46 | return (LL)ret;} 47 | 48 | #ifdef ONLINE_JUDGE 49 | //FILE *fin = freopen(stdin,"r",stdin); 50 | //FILE *fout = freopen(stdout,"w",stdout); 51 | #endif 52 | 53 | int main() 54 | { 55 | for(int i = 0; i<100; i++)cout< 4 | 5 | using namespace std; 6 | 7 | #define TRACE 8 | #ifdef TRACE 9 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 10 | template 11 | void __f(const char* name, Arg1&& arg1){ 12 | cerr << name << " : " << arg1 << std::endl; 13 | } 14 | template 15 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 16 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 17 | } 18 | #else 19 | #define trace(...) 20 | #endif 21 | 22 | #define si(x) scanf("%d",&x) 23 | #define F first 24 | #define S second 25 | #define PB push_back 26 | #define MP make_pair 27 | 28 | 29 | typedef long long LL; 30 | typedef pair PII; 31 | typedef vector VI; 32 | typedef vector VPII; 33 | 34 | FILE *fin = freopen("bubble.in","r",stdin); 35 | FILE *fout = freopen("bubble.out","w",stdout); 36 | 37 | 38 | int main() 39 | { 40 | ios_base::sync_with_stdio(false); 41 | int n; 42 | unsigned long long int k; 43 | cin>>n>>k; 44 | while(!(n==0 && k==0)) 45 | { 46 | k--; 47 | int p=0; 48 | for(p=0; (1ull<=0) 53 | { 54 | p--; 55 | while(p>=0 && (((1ull<=0 && ((1ull<>n>>k; 66 | } 67 | return 0; 68 | } 69 | 70 | -------------------------------------------------------------------------------- /100517/K.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100517/K.out -------------------------------------------------------------------------------- /100517/K.out.dSYM/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleIdentifier 8 | com.apple.xcode.dsym.K.out 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | dSYM 13 | CFBundleSignature 14 | ???? 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleVersion 18 | 1 19 | 20 | 21 | -------------------------------------------------------------------------------- /100517/K.out.dSYM/Contents/Resources/DWARF/K.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100517/K.out.dSYM/Contents/Resources/DWARF/K.out -------------------------------------------------------------------------------- /100517/K_in: -------------------------------------------------------------------------------- 1 | 5 2 | 0 0 3 | 6 0 4 | 6 4 5 | 3 6 6 | 0 4 7 | 4 1 8 | 1 4 9 | 4 10 | 0 0 11 | 4 0 12 | 4 4 13 | 0 4 14 | 1 1 15 | 3 1 16 | 0 17 | -------------------------------------------------------------------------------- /100517/K_out1: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 0 4 | 0 5 | 0 6 | 0 7 | 0 8 | 0 9 | 0 10 | 0 11 | 0 12 | 0 13 | 0 14 | 0 15 | 0 16 | 0 17 | 0 18 | 0 19 | 0 20 | 0 21 | 0 22 | 0 23 | 0 24 | 0 25 | 0 26 | 0 27 | 0 28 | 0 29 | 0 30 | 0 31 | 0 32 | 0 33 | 0 34 | 0 35 | 0 36 | 0 37 | 0 38 | 0 39 | 0 40 | 0 41 | 0 42 | 0 43 | 0 44 | 0 45 | 0 46 | 0 47 | 0 48 | 0 49 | 0 50 | 0 51 | 0 52 | 0 53 | 0 54 | 0 55 | 0 56 | 0 57 | 0 58 | 0 59 | 0 60 | 0 61 | 0 62 | 0 63 | 0 64 | 0 65 | 0 66 | 0 67 | 0 68 | 0 69 | 0 70 | 0 71 | 0 72 | 0 73 | 0 74 | 0 75 | 0 76 | 0 77 | 0 78 | 0 79 | 0 80 | 0 81 | 0 82 | 0 83 | 0 84 | 1 85 | 1 86 | 1 87 | 1 88 | 1 89 | 1 90 | 0 91 | 0 92 | 0 93 | 0 94 | 0 95 | 0 96 | 0 97 | 0 98 | 0 99 | 0 100 | 0 101 | 0 102 | 1 103 | 1 104 | 1 105 | 1 106 | 1 107 | 1 108 | 2 109 | 2 110 | 2 111 | 2 112 | 2 113 | 1 114 | 1 115 | 1 116 | 1 117 | 1 118 | 1 119 | 0 120 | 0 121 | 0 122 | 0 123 | 0 124 | 0 125 | 1 126 | 1 127 | 1 128 | 1 129 | 1 130 | 1 131 | 2 132 | 2 133 | 2 134 | 2 135 | 2 136 | 1 137 | 1 138 | 1 139 | 1 140 | 1 141 | 1 142 | 0 143 | 0 144 | 0 145 | 0 146 | 0 147 | 0 148 | 1 149 | 1 150 | 1 151 | 1 152 | 1 153 | 1 154 | 2 155 | 2 156 | 2 157 | 2 158 | 2 159 | 1 160 | 1 161 | 1 162 | 1 163 | 1 164 | 1 165 | 0 166 | 0 167 | 0 168 | 0 169 | 0 170 | 0 171 | 1 172 | -------------------------------------------------------------------------------- /100517/K_out2: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 0 4 | 0 5 | 0 6 | 0 7 | 0 8 | 0 9 | 0 10 | 0 11 | 0 12 | 0 13 | 0 14 | 0 15 | 0 16 | 0 17 | 0 18 | 0 19 | 0 20 | 0 21 | 0 22 | 0 23 | 0 24 | 0 25 | 0 26 | 0 27 | 0 28 | 0 29 | 0 30 | 0 31 | 0 32 | 0 33 | 0 34 | 0 35 | 0 36 | 0 37 | 0 38 | 0 39 | 0 40 | 0 41 | 0 42 | 0 43 | 0 44 | 0 45 | 0 46 | 0 47 | 0 48 | 0 49 | 0 50 | 0 51 | 0 52 | 0 53 | 0 54 | 0 55 | 0 56 | 0 57 | 0 58 | 0 59 | 0 60 | 0 61 | 0 62 | 0 63 | 0 64 | 0 65 | 0 66 | 0 67 | 0 68 | 0 69 | 0 70 | 0 71 | 0 72 | 0 73 | 0 74 | 0 75 | 0 76 | 0 77 | 0 78 | 0 79 | 1 80 | 1 81 | 1 82 | 1 83 | 1 84 | 1 85 | 1 86 | 1 87 | 1 88 | 1 89 | 1 90 | 0 91 | 0 92 | 0 93 | 0 94 | 0 95 | 0 96 | 0 97 | 0 98 | 0 99 | 0 100 | 0 101 | 0 102 | 1 103 | 1 104 | 1 105 | 1 106 | 1 107 | 1 108 | 2 109 | 2 110 | 2 111 | 2 112 | 2 113 | 1 114 | 1 115 | 1 116 | 1 117 | 1 118 | 1 119 | 0 120 | 0 121 | 0 122 | 0 123 | 0 124 | 0 125 | 1 126 | 1 127 | 1 128 | 1 129 | 1 130 | 1 131 | 2 132 | 2 133 | 2 134 | 2 135 | 2 136 | 1 137 | 1 138 | 1 139 | 1 140 | 1 141 | 1 142 | 0 143 | 0 144 | 0 145 | 0 146 | 0 147 | 0 148 | 1 149 | 1 150 | 1 151 | 1 152 | 1 153 | 1 154 | 2 155 | 2 156 | 2 157 | 2 158 | 2 159 | 1 160 | 1 161 | 1 162 | 1 163 | 1 164 | 1 165 | 0 166 | 0 167 | 0 168 | 0 169 | 0 170 | 0 171 | 1 172 | -------------------------------------------------------------------------------- /100517/a (Karan Aggarwal's conflicted copy 2015-12-09).out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100517/a (Karan Aggarwal's conflicted copy 2015-12-09).out -------------------------------------------------------------------------------- /100517/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100517/a.out -------------------------------------------------------------------------------- /100517/in: -------------------------------------------------------------------------------- 1 | 5 2 | 0 0 3 | 6 0 4 | 6 4 5 | 3 6 6 | 0 4 7 | 4 1 8 | 1 4 9 | 4 10 | 0 0 11 | 4 0 12 | 4 4 13 | 0 4 14 | 1 1 15 | 3 1 16 | 0 17 | -------------------------------------------------------------------------------- /100517/inL: -------------------------------------------------------------------------------- 1 | 7 2 | 2 3 4 5 0 0 6 7 0 0 0 0 0 0 3 | 7 4 | 2 3 0 0 4 5 6 7 0 0 0 0 0 0 5 | 6 | 7 7 | 2 3 4 5 0 0 6 7 0 0 0 0 0 0 8 | 7 9 | 2 3 4 5 6 7 0 0 0 0 0 0 0 0 10 | 0 11 | -------------------------------------------------------------------------------- /100517/inL2: -------------------------------------------------------------------------------- 1 | 1 2 | 0 0 3 | 3 4 | 2 3 5 | 0 0 6 | 0 0 7 | 0 8 | -------------------------------------------------------------------------------- /100540/.F.cpp (Karan Aggarwal's conflicted copy 2015-12-13).swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100540/.F.cpp (Karan Aggarwal's conflicted copy 2015-12-13).swp -------------------------------------------------------------------------------- /100540/A.cpp: -------------------------------------------------------------------------------- 1 | // akshayjaggi 2 | 3 | #include 4 | 5 | using namespace std; 6 | 7 | #define TRACE 8 | #ifdef TRACE 9 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 10 | template 11 | void __f(const char* name, Arg1&& arg1){ 12 | cerr << name << " : " << arg1 << std::endl; 13 | } 14 | template 15 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 16 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 17 | } 18 | #else 19 | #define trace(...) 20 | #endif 21 | 22 | #define si(x) scanf("%d",&x) 23 | #define F first 24 | #define S second 25 | #define PB push_back 26 | #define MP make_pair 27 | 28 | 29 | typedef long long LL; 30 | typedef pair PII; 31 | typedef vector VI; 32 | typedef vector VPII; 33 | 34 | #ifdef ONLINE_JUDGE 35 | //FILE *fin = freopen("in","r",stdin); 36 | //FILE *fout = freopen("out","w",stdout); 37 | #endif 38 | 39 | int main() 40 | { 41 | //ios_base::sync_with_stdio(false); 42 | int S,B; 43 | si(S); 44 | si(B); 45 | while(S!=0 && B!=0) 46 | { 47 | list lis; 48 | map::iterator> mp; 49 | for(int i=0; i<=S+1; i++) 50 | { 51 | lis.push_back(i); 52 | mp[i]=--lis.end(); 53 | } 54 | for(int i=0; i 4 | 5 | using namespace std; 6 | 7 | #define TRACE 8 | #ifdef TRACE 9 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 10 | template 11 | void __f(const char* name, Arg1&& arg1){ 12 | cerr << name << " : " << arg1 << std::endl; 13 | } 14 | template 15 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 16 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 17 | } 18 | #else 19 | #define trace(...) 20 | #endif 21 | 22 | #define si(x) scanf("%d",&x) 23 | #define F first 24 | #define S second 25 | #define PB push_back 26 | #define MP make_pair 27 | 28 | 29 | typedef long long LL; 30 | typedef pair PII; 31 | typedef vector VI; 32 | typedef vector VPII; 33 | 34 | #ifdef ONLINE_JUDGE 35 | //FILE *fin = freopen("in","r",stdin); 36 | //FILE *fout = freopen("out","w",stdout); 37 | #endif 38 | 39 | LL dp[1002][1002]; 40 | LL ans = 0; 41 | 42 | vector v[1001]; 43 | 44 | int main() 45 | { 46 | //ios_base::sync_with_stdio(false); 47 | int N; 48 | si(N); 49 | while(N!=0) 50 | { 51 | //memset(dp,0,sizeof(dp)); 52 | for(int i=1; i<=N; i++) v[i].clear(); 53 | ans=0; 54 | for(int i=1; i<=N; i++) 55 | { 56 | for(int j=0; j 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define si(x) scanf("%d",&x) 20 | #define F first 21 | #define S second 22 | #define PB push_back 23 | #define MP make_pair 24 | 25 | typedef long long LL; 26 | typedef pair PII; 27 | typedef vector VI; 28 | 29 | 30 | int gcd(int a, int b) 31 | { 32 | if(b)return gcd(b,a%b); return a; 33 | } 34 | 35 | int C[100009]; 36 | 37 | int foo(int K, int N) 38 | { 39 | for(int i = 0; i 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define si(x) scanf("%d",&x) 20 | #define F first 21 | #define S second 22 | #define PB push_back 23 | #define MP make_pair 24 | 25 | typedef long long LL; 26 | typedef pair PII; 27 | typedef vector VI; 28 | typedef vector VPII; 29 | 30 | int A[3]; 31 | 32 | void print() 33 | { 34 | sort(A,A+3); 35 | if(A[2]>13 or A[0]<1){cout<<"*\n"; return;} 36 | for(int i =0; i<3; i++) cout<>x; 28 | VLL tp = f(x); 29 | cout< 4 | 5 | using namespace std; 6 | 7 | #define TRACE 8 | #ifdef TRACE 9 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 10 | template 11 | void __f(const char* name, Arg1&& arg1){ 12 | cerr << name << " : " << arg1 << std::endl; 13 | } 14 | template 15 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 16 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 17 | } 18 | #else 19 | #define trace(...) 20 | #endif 21 | 22 | #define si(x) scanf("%d",&x) 23 | #define F first 24 | #define S second 25 | #define PB push_back 26 | #define MP make_pair 27 | 28 | 29 | typedef long long LL; 30 | typedef pair PII; 31 | typedef vector VI; 32 | typedef vector VPII; 33 | 34 | #ifdef ONLINE_JUDGE 35 | FILE *fin = freopen("ate.in","r",stdin); 36 | FILE *fout = freopen("ate.out","w",stdout); 37 | #endif 38 | 39 | int main() 40 | { 41 | //ios_base::sync_with_stdio(false); 42 | int n; 43 | si(n); 44 | int ans=0; 45 | for(int i=0; i<=99; i++) 46 | if(n-i <=99) 47 | ans++; 48 | printf("%d\n",ans); 49 | return 0; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /100609/F.cpp: -------------------------------------------------------------------------------- 1 | // akshayjaggi 2 | 3 | #include 4 | 5 | using namespace std; 6 | 7 | #define TRACE 8 | #ifdef TRACE 9 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 10 | template 11 | void __f(const char* name, Arg1&& arg1){ 12 | cerr << name << " : " << arg1 << std::endl; 13 | } 14 | template 15 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 16 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 17 | } 18 | #else 19 | #define trace(...) 20 | #endif 21 | 22 | #define si(x) scanf("%d",&x) 23 | #define F first 24 | #define S second 25 | #define PB push_back 26 | #define MP make_pair 27 | 28 | 29 | typedef long long LL; 30 | typedef pair PII; 31 | typedef vector VI; 32 | typedef vector VPII; 33 | 34 | #ifdef ONLINE_JUDGE 35 | FILE *fin = freopen("flat.in","r",stdin); 36 | FILE *fout = freopen("flat.out","w",stdout); 37 | #endif 38 | 39 | int main() 40 | { 41 | ios_base::sync_with_stdio(false); 42 | int n; double c; 43 | cin>>n>>c; 44 | double arr=0; 45 | int arr_room=0, bed=0; 46 | for(int i=0; i>ctmp>>stmp; 51 | if(stmp=="balcony") 52 | arr+=((ctmp*1.0)/2.0); 53 | else 54 | arr+=ctmp; 55 | arr_room+=ctmp; 56 | if(stmp=="bedroom") 57 | bed+=ctmp; 58 | } 59 | cout< 2 | #define PB push_back 3 | #define MP make_pair 4 | #define F first 5 | #define S second 6 | #define SZ(a) (int)(a.size()) 7 | #define SET(a,b) memset(a,b,sizeof(a)) 8 | #define LET(x,a) __typeof(a) x(a) 9 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 10 | #define repi(i,n) for(int i=0; i<(int)n;i++) 11 | #define sd(n) scanf("%d",&n) 12 | #define si(n) scanf("%d",&n) 13 | #define sl(n) scanf("%lld",&n) 14 | using namespace std; 15 | 16 | 17 | typedef long long LL; 18 | typedef pair PII; 19 | 20 | #ifdef ONLINE_JUDGE 21 | FILE *fin = freopen("john.in","r",stdin); 22 | FILE *fout = freopen("john.out","w",stdout); 23 | #endif 24 | 25 | int BIT[100001]; 26 | 27 | int query(int x) 28 | { 29 | int ret = 0; 30 | while(x>0){ 31 | ret += BIT[x]; 32 | x &= (x-1); 33 | } 34 | return ret; 35 | } 36 | void update(int id) 37 | { 38 | while(id<=100000) 39 | { 40 | BIT[id]++; 41 | id += (id & (-id)); 42 | } 43 | } 44 | 45 | mapM; 46 | PII A[100000]; 47 | 48 | int main() 49 | { 50 | int N; si(N); 51 | for(int i =0; i ConvexHull(vector P) { 8 | int n = P.size(), k = 0; vector H(2*n); 9 | sort(P.begin(), P.end()); 10 | for (int i = 0; i < n; i++) 11 | { while (k >= 2 && cross(H[k-2], H[k-1], P[i]) <= 0) k--; H[k++] = P[i]; }28 12 | for (int i = n-2, t = k+1; i >= 0; i--) 13 | { while (k >= t && cross(H[k-2], H[k-1], P[i]) <= 0) k--; H[k++] = P[i]; } 14 | H.resize(k); 15 | return H; 16 | } 17 | -------------------------------------------------------------------------------- /100609/in: -------------------------------------------------------------------------------- 1 | 8 2 | -99999999 -100000000 3 | 99999999 -100000000 4 | 100000000 -99999999 5 | 100000000 99999999 6 | 99999999 100000000 7 | -99999999 100000000 8 | -100000000 99999999 9 | -100000000 -99999999 10 | -------------------------------------------------------------------------------- /100609/in1: -------------------------------------------------------------------------------- 1 | 7 2 | aaaaa 3 | aaaaa 4 | aaaa1 5 | aaaA2 6 | aaBCD 7 | a6543 8 | XxXxX 9 | -------------------------------------------------------------------------------- /100609/in2: -------------------------------------------------------------------------------- 1 | 6 6 2 | 1 2 10 3 | 2 3 10 4 | 3 4 5 5 | 4 5 10 6 | 5 6 20 7 | 2 5 10 8 | -------------------------------------------------------------------------------- /100609/in3: -------------------------------------------------------------------------------- 1 | 4 3 2 | 1 2 10 3 | 1 3 10 4 | 1 4 50 5 | -------------------------------------------------------------------------------- /100609/inG: -------------------------------------------------------------------------------- 1 | 5 4 5 2 | 1 2 3 | 2 3 4 | 3 4 5 | 4 1 6 | 5 3 7 | -------------------------------------------------------------------------------- /100609/inG2: -------------------------------------------------------------------------------- 1 | 6 4 9 2 | 1 2 3 | 2 3 4 | 3 4 5 | 4 1 6 | 5 2 7 | 5 3 8 | 6 5 9 | 6 4 10 | 6 1 11 | -------------------------------------------------------------------------------- /100609/out: -------------------------------------------------------------------------------- 1 | i : 0 | c.F : | c.S : 3 2 | i : 1 | c.F : c | c.S : 1 3 | i : 1 | c.F : a | c.S : 2 4 | i : 2 | c.F : c | c.S : 1 5 | i : 2 | c.F : b | c.S : 2 6 | i : 3 | c.F : ac | c.S : 1 7 | i : 3 | c.F : cb | c.S : 1 8 | i : 3 | c.F : ab | c.S : 1 9 | j : 0 | nmask : 0 10 | j : 0 | nmask : 1 11 | j : 0 | nmask : 2 12 | j : 0 | nmask : 3 13 | i : 0 | j : 0 | tot : 0 14 | j : 1 | nmask : 1 15 | j : 1 | nmask : 3 16 | i : 0 | j : 1 | tot : 1 17 | j : 2 | nmask : 2 18 | j : 2 | nmask : 3 19 | i : 0 | j : 2 | tot : 1 20 | j : 3 | nmask : 3 21 | i : 0 | j : 3 | tot : 0 22 | j : 0 | nmask : 0 23 | j : 0 | nmask : 1 24 | j : 0 | nmask : 2 25 | j : 0 | nmask : 3 26 | i : 1 | j : 0 | tot : 1 27 | j : 1 | nmask : 1 28 | j : 1 | nmask : 3 29 | i : 1 | j : 1 | tot : 1 30 | j : 2 | nmask : 2 31 | j : 2 | nmask : 3 32 | i : 1 | j : 2 | tot : 0 33 | j : 3 | nmask : 3 34 | i : 1 | j : 3 | tot : 0 35 | j : 0 | nmask : 0 36 | j : 0 | nmask : 1 37 | j : 0 | nmask : 2 38 | j : 0 | nmask : 3 39 | i : 2 | j : 0 | tot : 1 40 | j : 1 | nmask : 1 41 | j : 1 | nmask : 3 42 | i : 2 | j : 1 | tot : 0 43 | j : 2 | nmask : 2 44 | j : 2 | nmask : 3 45 | i : 2 | j : 2 | tot : 1 46 | j : 3 | nmask : 3 47 | i : 2 | j : 3 | tot : 0 48 | ans[i] : 0 49 | ans[i] : 4 50 | ans[i] : 2 51 | ans[i] : 0 52 | ans[i] : 0 53 | -------------------------------------------------------------------------------- /100610/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | FILE *fin = freopen("acm.in","r",stdin); 28 | FILE *fout = freopen("acm.out","w",stdout); 29 | 30 | typedef long long LL; 31 | typedef pair PII; 32 | typedef vector VI; 33 | typedef vector< PII > VPII; 34 | 35 | int A[10],B[10]; 36 | 37 | int main() 38 | { 39 | int N,M; si(N); si(M); 40 | for(int i =0; i 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | FILE *fin = freopen("defense.in","r",stdin); 28 | FILE *fout = freopen("defense.out","w",stdout); 29 | 30 | typedef long long LL; 31 | typedef pair PII; 32 | typedef vector VI; 33 | typedef vector< PII > VPII; 34 | 35 | 36 | int main() 37 | { 38 | set X,Y; 39 | int w,h; si(w); si(h); 40 | int N; si(N); 41 | for(int i = 0; i 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | FILE *fin = freopen("explicit.in","r",stdin); 29 | FILE *fout = freopen("explicit.out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | 38 | int main() 39 | { 40 | int ar[10],cnt=0; 41 | for(int i=0; i<10; i++) 42 | si(ar[i]); 43 | for(int i=0; i<10; i++) 44 | for(int j=i+1; j<10; j++) 45 | if(ar[i]+ar[j]!=0) 46 | cnt++; 47 | for(int i=0; i<10; i++) 48 | for(int j=i+1; j<10; j++) 49 | for(int k=j+1; k<10; k++) 50 | if(ar[i]+ar[j] + ar[k]!=0) 51 | cnt++; 52 | if(cnt%2)cout << 1 << endl; 53 | else cout << 0 << endl; 54 | return 0; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /100610/H.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | FILE *fin = freopen("horrible.in","r",stdin); 29 | FILE *fout = freopen("horrible.out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | 38 | int main() 39 | { 40 | int N; cin>>N; 41 | if(N==1) 42 | { 43 | cout<<1< 2 | using namespace std; 3 | 4 | #ifdef TRACE 5 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 6 | template 7 | void __f(const char* name, Arg1&& arg1){ 8 | cerr << name << " : " << arg1 << std::endl; 9 | } 10 | template 11 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 12 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 13 | } 14 | #else 15 | #define trace(...) 16 | #endif 17 | 18 | #define PB push_back 19 | #define MP make_pair 20 | #define F first 21 | #define S second 22 | #define si(n) scanf("%d",&n) 23 | #define sll(n) scanf("%lld",&n) 24 | #define DRT() int t; cin>>t; while(t--) 25 | 26 | 27 | 28 | FILE *fin = freopen("auxiliary.in","r",stdin); 29 | FILE *fout = freopen("auxiliary.out","w",stdout); 30 | 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | 38 | bool is_dig(char c){ 39 | return c>='0' and c<='9'; 40 | } 41 | 42 | int main() 43 | { 44 | string A,B=""; 45 | cin>>A; 46 | int cnt = 0; 47 | for(auto c : A) 48 | { 49 | if(c=='(')cnt++; 50 | if(c==')')cnt--; 51 | if(cnt<0){ B += '('; cnt++;} 52 | B += c; 53 | } 54 | while(cnt--)B += ')'; 55 | A = '(' + B + ')'; 56 | 57 | B = "("; 58 | for(int i = 1; i 2 | using namespace std; 3 | 4 | //#define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | FILE *fin = freopen("bureau.in","r",stdin); 28 | FILE *fout = freopen("bureau.out","w",stdout); 29 | 30 | 31 | typedef long long LL; 32 | typedef pair PII; 33 | typedef vector VI; 34 | typedef vector< PII > VPII; 35 | 36 | vector ans, proc; 37 | int Hash[100005]; 38 | 39 | int main() 40 | { 41 | int n; 42 | cin>>n; 43 | memset(Hash, 0, sizeof(Hash)); 44 | for(int i=0; i>s; 48 | if(s=="declare") 49 | proc.PB(-1); 50 | else 51 | { 52 | int t; 53 | cin>>t; 54 | t--; 55 | proc.PB(t); 56 | } 57 | } 58 | for(int i=proc.size()-1; i>=0; i--) 59 | { 60 | if(Hash[i]==1) 61 | continue; 62 | ans.PB(i); 63 | if(proc[i]==-1) 64 | continue; 65 | Hash[proc[i]]=1; 66 | } 67 | cout<=0; i--) 69 | cout< 2 | using namespace std; 3 | 4 | //#define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | FILE *fin = freopen("dragon.in","r",stdin); 28 | FILE *fout = freopen("dragon.out","w",stdout); 29 | 30 | 31 | typedef long long LL; 32 | typedef pair PII; 33 | typedef vector VI; 34 | typedef vector< PII > VPII; 35 | 36 | 37 | int main() 38 | { 39 | int n,d; 40 | cin>>n>>d; 41 | if(n<=7) 42 | { 43 | int val=1; 44 | for(int i=0; i 2 | using namespace std; 3 | 4 | //#define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | FILE *fin = freopen("homo.in","r",stdin); 28 | FILE *fout = freopen("homo.out","w",stdout); 29 | 30 | 31 | typedef long long LL; 32 | typedef pair PII; 33 | typedef vector VI; 34 | typedef vector< PII > VPII; 35 | 36 | 37 | int main() 38 | { 39 | ios::sync_with_stdio(0); 40 | int n; 41 | cin >> n; 42 | map m; 43 | int cnt=0; 44 | while(n--){ 45 | string s; int val; 46 | cin >> s >> val; 47 | if(s=="insert")m[val]++, cnt++; 48 | else{ 49 | if(m.count(val)){ 50 | m[val]--; 51 | if(m[val]==0) 52 | m.erase(val); 53 | cnt--; 54 | } 55 | } 56 | int fl=0; 57 | if(m.size()1)fl+=2; 60 | if(fl==0)cout << "neither\n"; 61 | else if(fl==1)cout << "homo\n"; 62 | else if(fl==2)cout << "hetero\n"; 63 | else cout << "both\n"; 64 | } 65 | return 0; 66 | } 67 | 68 | -------------------------------------------------------------------------------- /100622/J.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 5 | template 6 | void __f(const char* name, Arg1&& arg1){ 7 | cerr << name << " : " << arg1 << std::endl; 8 | } 9 | template 10 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 11 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 12 | } 13 | 14 | #define PB push_back 15 | #define MP make_pair 16 | #define F first 17 | #define S second 18 | #define si(n) scanf("%d",&n) 19 | #define sll(n) scanf("%lld",&n) 20 | #define DRT() int t; cin>>t; while(t--) 21 | 22 | FILE *fin = freopen("jealous.in","r",stdin); 23 | FILE *fout = freopen("jealous.out","w",stdout); 24 | 25 | 26 | typedef long long LL; 27 | typedef pair PII; 28 | typedef vector VI; 29 | typedef vector< PII > VPII; 30 | 31 | 32 | LL CA[101][101]; 33 | LL CB[101][101]; 34 | int p,q; 35 | 36 | void f( LL X, LL C[101][101]) 37 | { 38 | C[0][0] = X; 39 | for(int i = 0; ;i++) 40 | { 41 | if(i) C[i][0] = C[i-1][0] / p; 42 | if(C[i][0]==0)break; 43 | for(int j = 1; ;j++){ 44 | C[i][j] = C[i][j-1] / q; 45 | if(C[i][j]==0)break; 46 | } 47 | } 48 | for(int i = 0; i<100; i++) 49 | for(int j = 0; j<100; j++){ 50 | C[i][j]-=C[i+1][j]; 51 | C[i][j]-=C[i][j+1]; 52 | C[i][j]+=C[i+1][j+1]; 53 | } 54 | } 55 | 56 | int main() 57 | { 58 | LL a,b; 59 | cin>>a>>b>>p>>q; a--; 60 | f(a,CA); f(b,CB); 61 | LL ans = 0; 62 | for(int i = 1; i<=100; i++) 63 | for(int j = 0; j 2 | using namespace std; 3 | 4 | //#define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | //FILE *fin = freopen("in","r",stdin); 28 | //FILE *fout = freopen("out","w",stdout); 29 | 30 | 31 | typedef long long LL; 32 | typedef pair PII; 33 | typedef vector VI; 34 | typedef vector< PII > VPII; 35 | 36 | bool f(int x){ 37 | return x>=6; 38 | } 39 | 40 | int main() 41 | { 42 | int l=0, r=5; 43 | while(r-l>1){ 44 | int mid=(l+r)/2; 45 | if(f(mid))r=mid; 46 | else l=mid; 47 | } 48 | cout << l+1 << endl; 49 | return 0; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /100622/try.py: -------------------------------------------------------------------------------- 1 | cur=2 2 | d=[] 3 | d.append(cur) 4 | cnt =0 5 | while 1: 6 | cur=(cur*2)%528 7 | print cur 8 | cnt += 1 9 | if cur in d: 10 | print cnt 11 | break; 12 | d.append(cur) 13 | -------------------------------------------------------------------------------- /100624/A.cpp: -------------------------------------------------------------------------------- 1 | 2 | // karanaggarwal 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | using namespace std; 13 | 14 | #define si(x) scanf("%d",&x) 15 | #define F first 16 | #define S second 17 | #define PB push_back 18 | #define MP make_pair 19 | 20 | 21 | typedef long long LL; 22 | typedef pair PII; 23 | typedef vector VI; 24 | typedef vector VPII; 25 | 26 | 27 | int N; 28 | int A[20][20]; 29 | int DP[1<<20]; 30 | 31 | int dp(int mask) 32 | { 33 | int &ret = DP[mask]; 34 | if(ret!=-1)return ret; 35 | ret = mask; 36 | if((mask & (mask-1) )) 37 | { 38 | ret = 0; 39 | for(int i=0; i0) 46 | ret |= dp(mask - (1< 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | #define si(x) scanf("%d",&x) 13 | #define F first 14 | #define S second 15 | #define PB push_back 16 | #define MP make_pair 17 | 18 | 19 | typedef long long LL; 20 | typedef pair PII; 21 | typedef vector VI; 22 | typedef vector VPII; 23 | 24 | 25 | int N; 26 | vector> mymap; 27 | vector> potential_unique; 28 | int A[200000]; 29 | VI P[200001]; 30 | 31 | int main() 32 | { 33 | int t; si(t); 34 | while(t--) 35 | { 36 | map mp; 37 | si(N); 38 | for(int i=0; i 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | #define si(x) scanf("%d",&x) 13 | #define F first 14 | #define S second 15 | #define PB push_back 16 | #define MP make_pair 17 | 18 | 19 | typedef long long LL; 20 | typedef pair PII; 21 | typedef vector VI; 22 | typedef vector VPII; 23 | 24 | 25 | 26 | struct point 27 | { 28 | LL x,y; 29 | }; 30 | 31 | struct line 32 | { 33 | LL a,b,c; 34 | }; 35 | 36 | 37 | void MakeLine(line &l, point p1, point p2) 38 | { 39 | LL dx = p2.x - p1.x; 40 | LL dy = p2.y - p1.y; 41 | l.a = -dy; 42 | l.b = dx; 43 | l.c = dy * p1.x - dx * p1.y; 44 | } 45 | 46 | int Polarity(line l, point p) 47 | { 48 | LL c = p.x * l.a + l.b * p.y + l.c; 49 | if(c==0)return c; 50 | if(c<0)return -1; return 1; 51 | } 52 | 53 | 54 | 55 | bool intersect(line &l, line &m, point &p) 56 | { 57 | 58 | } 59 | 60 | 61 | int main() 62 | { 63 | return 0; 64 | } 65 | -------------------------------------------------------------------------------- /100624/in: -------------------------------------------------------------------------------- 1 | 3 2 | 10 3 3 | 1 2 3 4 | 2 1 1 5 | 2 4 2 6 | 3 5 3 7 | 4 4 2 8 | 5 1 2 9 | 6 3 1 10 | 6 7 1 11 | 7 2 3 12 | 9 4 2 13 | 10 3 14 | 1 2 3 15 | 2 1 1 16 | 2 4 2 17 | 3 5 3 18 | 4 4 2 19 | 5 1 2 20 | 6 3 1 21 | 6 7 1 22 | 7 2 3 23 | 9 4 2 24 | 10 3 25 | 1 2 3 26 | 2 1 1 27 | 2 4 2 28 | 3 5 3 29 | 4 4 2 30 | 5 1 2 31 | 6 3 1 32 | 6 7 1 33 | 7 2 3 34 | 9 4 2 35 | -------------------------------------------------------------------------------- /100676/F.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | #define si(x) scanf("%d",&x) 14 | #define F first 15 | #define S second 16 | #define PB push_back 17 | #define MP make_pair 18 | #define MOD 1000000007 19 | 20 | typedef long long LL; 21 | typedef pair PII; 22 | typedef vector VI; 23 | typedef vector VPII; 24 | 25 | int visited[50005]; 26 | vector V[50005]; 27 | string s; 28 | 29 | set sss; 30 | 31 | void dfs(int i) 32 | { 33 | visited[i]=1; 34 | if(s[i-1]!='?') 35 | sss.insert(s[i-1]); 36 | for(auto it=V[i].begin(); it!=V[i].end(); it++) 37 | { 38 | if(!visited[*it]) 39 | { 40 | dfs(*it); 41 | } 42 | } 43 | } 44 | 45 | int main() 46 | { 47 | int n,m; 48 | int T; 49 | cin>>T; 50 | while(T--) 51 | { 52 | cin>>n>>m; 53 | for(int i=0;i>s; 57 | for(int i=0;i>a>>b; 61 | V[a].push_back(b); 62 | V[b].push_back(a); 63 | } 64 | for(int i=0;i=2) 82 | { 83 | ans*=0; 84 | } 85 | } 86 | } 87 | cout< 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | #define si(x) scanf("%d",&x) 13 | #define F first 14 | #define S second 15 | #define PB push_back 16 | #define MP make_pair 17 | 18 | 19 | typedef long long LL; 20 | typedef pair PII; 21 | typedef vector VI; 22 | typedef vector VPII; 23 | 24 | int DP[1<<18]; 25 | PII E[1000]; 26 | int ind[18]; 27 | int W[18]; 28 | char Name[18][1000]; 29 | 30 | 31 | int N,M; 32 | int dp(int mask) 33 | { 34 | if(DP[mask]!=-1)return DP[mask]; 35 | int &ret = DP[mask]; 36 | ret = 0; 37 | int k = (N+1) - __builtin_popcount(mask); 38 | for(int i = 0; i mm; 60 | for(int i=0; i"); 74 | scanf(" %[^\n]",XX); 75 | string tmp(XX); 76 | tmp=tmp+" "; 77 | y=mm[tmp]; 78 | E[i] = MP(x,y); 79 | } 80 | for(int i=0; i 2 | #define assn(n,a,b) assert(n<=b and n>=a) 3 | #define pb push_back 4 | #define mp make_pair 5 | #define F first 6 | #define S second 7 | #define SZ(a) (int)(a.size()) 8 | #define SET(a,b) memset(a,b,sizeof(a)) 9 | #define LET(x,a) __typeof(a) x(a) 10 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 11 | #define repi(i,n) for(int i=0; i<(int)n;i++) 12 | #define sd(n) scanf("%d",&n) 13 | #define sl(n) scanf("%lld",&n) 14 | #define sortv(a) sort(a.begin(),a.end()) 15 | #define all(a) a.begin(),a.end() 16 | #define DRT() int t; cin>>t; while(t--) 17 | using namespace std; 18 | 19 | //FILE *fin = freopen("in","r",stdin); 20 | //FILE *fout = freopen("out","w",stdout); 21 | 22 | #define TRACE 23 | #ifdef TRACE 24 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 25 | template 26 | void __f(const char* name, Arg1&& arg1){ 27 | cerr << name << " : " << arg1 << std::endl; 28 | } 29 | template 30 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 31 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 32 | } 33 | #else 34 | #define trace(...) 35 | #endif 36 | 37 | typedef long long LL; 38 | typedef pair PII; 39 | typedef vector VI; 40 | typedef vector< PII > VPII; 41 | 42 | #define MOD 1000000007ll 43 | LL mpow(LL a, LL n) 44 | {LL ret=1;LL b=a;while(n) {if(n&1) 45 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 46 | return (LL)ret;} 47 | 48 | int ar[1009]; 49 | int main() 50 | { 51 | int n,total=0,ans=0; 52 | sd(n); 53 | for(int i=0; itotal)ans++; 59 | cout << ans << endl; 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /100685/F.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace std; 15 | 16 | #define TRACE 17 | #ifdef TRACE 18 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 19 | template 20 | void __f(const char* name, Arg1&& arg1){ 21 | cerr << name << " : " << arg1 << std::endl; 22 | } 23 | template 24 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 25 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 26 | } 27 | #else 28 | #define trace(...) 29 | #endif 30 | 31 | #define si(x) scanf("%d",&x) 32 | #define F first 33 | #define S second 34 | #define PB push_back 35 | #define MP make_pair 36 | 37 | 38 | typedef long long LL; 39 | typedef pair PII; 40 | typedef vector VI; 41 | typedef vector VPII; 42 | 43 | double C[10000],L[10000]; 44 | VI E[10000]; 45 | int deg[10000]; 46 | 47 | int main() 48 | { 49 | int n,m; si(n); si(m); 50 | for(int i = 0; i>L[i]>>C[i]; 53 | } 54 | while(m--){int x,y; si(x); si(y); x--; y--; E[x].PB(y); deg[y]++;} 55 | int x,src,dest; 56 | si(src); 57 | si(x); 58 | si(dest); 59 | src--; dest--; C[src]+=x; 60 | VI tord; 61 | queue Q; for(int i=0; i 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace std; 15 | 16 | #define TRACE 17 | #ifdef TRACE 18 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 19 | template 20 | void __f(const char* name, Arg1&& arg1){ 21 | cerr << name << " : " << arg1 << std::endl; 22 | } 23 | template 24 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 25 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 26 | } 27 | #else 28 | #define trace(...) 29 | #endif 30 | 31 | #define si(x) scanf("%d",&x) 32 | #define F first 33 | #define S second 34 | #define PB push_back 35 | #define MP make_pair 36 | 37 | 38 | typedef long long LL; 39 | typedef pair PII; 40 | typedef vector VI; 41 | typedef vector VPII; 42 | 43 | void f(int l, int r, queue &ret) 44 | { 45 | queue L,R; 46 | if(l==r) 47 | { 48 | ret.push(l); return; 49 | } 50 | int m = (l+r)/2; 51 | f(l,m,L); f(m+1,r,R); 52 | while(!L.empty() and !R.empty()) 53 | { 54 | int x = L.front(); int y = R.front(); 55 | cout<<"1 "<>ch; 57 | if(ch=="YES") 58 | { 59 | ret.push(x); L.pop(); 60 | } 61 | else 62 | { 63 | ret.push(y); R.pop(); 64 | } 65 | } 66 | while(!L.empty()){int x = L.front(); L.pop(); ret.push(x);} 67 | while(!R.empty()){int x = R.front(); R.pop(); ret.push(x);} 68 | } 69 | 70 | int main() 71 | { 72 | int N; si(N); 73 | queue Q; 74 | f(1,N,Q); 75 | cout<<0; 76 | while(!Q.empty()){ int x = Q.front(); Q.pop(); cout<<" "< 4 | using namespace std; 5 | 6 | #define TRACE 7 | #ifdef TRACE 8 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 9 | template 10 | void __f(const char* name, Arg1&& arg1){ 11 | cerr << name << " : " << arg1 << std::endl; 12 | } 13 | template 14 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 15 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 16 | } 17 | #else 18 | #define trace(...) 19 | #endif 20 | 21 | #define si(x) scanf("%d",&x) 22 | #define F first 23 | #define S second 24 | #define PB push_back 25 | #define MP make_pair 26 | 27 | typedef pair PII; 28 | typedef vector VI; 29 | typedef vector VPII; 30 | 31 | VPII E[10001]; 32 | const int inf = 1000000000; 33 | int D[100001]; 34 | 35 | int main() 36 | { 37 | int t; si(t); while(t--) 38 | { 39 | int N,M; si(N); si(M); for(int i =1; i<=N; i++){E[i].clear();D[i] = inf;} 40 | while(M--) 41 | { 42 | int x,y,c; si(x); si(y); si(c); E[x].PB(MP(y,c)); 43 | } 44 | int s,d; si(s); si(d); 45 | for(int i = 1; i<=N; i++)D[i] = inf; 46 | D[s] = 0; set Q; 47 | Q.insert(s); 48 | while(!Q.empty()) 49 | { 50 | int x = *Q.begin(); Q.erase(x); 51 | for(auto p : E[x]) 52 | if(D[x] + p.S < D[p.F]) 53 | { 54 | D[p.F] = D[x] + p.S; Q.insert(p.F); 55 | } 56 | } 57 | if(D[d]!=inf)printf("%d\n",D[d]); else printf("NO\n"); 58 | } 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /100733/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define assn(n,a,b) assert(n<=b and n>=a) 3 | #define pb push_back 4 | #define mp make_pair 5 | #define F first 6 | #define S second 7 | #define SZ(a) (int)(a.size()) 8 | #define SET(a,b) memset(a,b,sizeof(a)) 9 | #define LET(x,a) __typeof(a) x(a) 10 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 11 | #define repi(i,n) for(int i=0; i<(int)n;i++) 12 | #define sd(n) scanf("%d",&n) 13 | #define sl(n) scanf("%lld",&n) 14 | #define sortv(a) sort(a.begin(),a.end()) 15 | #define all(a) a.begin(),a.end() 16 | #define DRT() int t; cin>>t; while(t--) 17 | using namespace std; 18 | 19 | //FILE *fin = freopen("in","r",stdin); 20 | //FILE *fout = freopen("out","w",stdout); 21 | 22 | #define TRACE 23 | #ifdef TRACE 24 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 25 | template 26 | void __f(const char* name, Arg1&& arg1){ 27 | cerr << name << " : " << arg1 << std::endl; 28 | } 29 | template 30 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 31 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 32 | } 33 | #else 34 | #define trace(...) 35 | #endif 36 | 37 | typedef long long LL; 38 | typedef pair PII; 39 | typedef vector VI; 40 | typedef vector< PII > VPII; 41 | 42 | #define MOD 1000000007ll 43 | LL mpow(LL a, LL n) 44 | {LL ret=1;LL b=a;while(n) {if(n&1) 45 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 46 | return (LL)ret;} 47 | 48 | #define M_P 3.14159265359 49 | 50 | int main() 51 | { 52 | double n,R,r; 53 | cin >> n >> R >> r; 54 | printf("%.9lf\n",n*R*r*sin(M_P/(double)n)); 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /100733/C.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define assn(n,a,b) assert(n<=b and n>=a) 3 | #define pb push_back 4 | #define mp make_pair 5 | #define F first 6 | #define S second 7 | #define SZ(a) (int)(a.size()) 8 | #define SET(a,b) memset(a,b,sizeof(a)) 9 | #define LET(x,a) __typeof(a) x(a) 10 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 11 | #define repi(i,n) for(int i=0; i<(int)n;i++) 12 | #define sd(n) scanf("%d",&n) 13 | #define sl(n) scanf("%lld",&n) 14 | #define sortv(a) sort(a.begin(),a.end()) 15 | #define all(a) a.begin(),a.end() 16 | #define DRT() int t; cin>>t; while(t--) 17 | using namespace std; 18 | 19 | //FILE *fin = freopen("in","r",stdin); 20 | //FILE *fout = freopen("out","w",stdout); 21 | 22 | #define TRACE 23 | #ifdef TRACE 24 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 25 | template 26 | void __f(const char* name, Arg1&& arg1){ 27 | cerr << name << " : " << arg1 << std::endl; 28 | } 29 | template 30 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 31 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 32 | } 33 | #else 34 | #define trace(...) 35 | #endif 36 | 37 | typedef long long LL; 38 | typedef pair PII; 39 | typedef vector VI; 40 | typedef vector< PII > VPII; 41 | 42 | #define MOD 1000000007ll 43 | LL mpow(LL a, LL n) 44 | {LL ret=1;LL b=a;while(n) {if(n&1) 45 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 46 | return (LL)ret;} 47 | 48 | int main() 49 | { 50 | string s; 51 | cin >> s; 52 | int ind=(int)s.length()-1; 53 | LL val=0; 54 | for(int i=0; i 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #else 22 | 23 | #include 24 | 25 | #endif // __APPLE__ 26 | 27 | using namespace std; 28 | 29 | #define TRACE 30 | #ifdef TRACE 31 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 32 | template 33 | void __f(const char* name, Arg1&& arg1){ 34 | cerr << name << " : " << arg1 << std::endl; 35 | } 36 | template 37 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 38 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 39 | } 40 | #else 41 | #define trace(...) 42 | #endif 43 | 44 | #define si(x) scanf("%d",&x) 45 | #define F first 46 | #define S second 47 | #define PB push_back 48 | #define MP make_pair 49 | 50 | 51 | typedef long long LL; 52 | typedef pair PII; 53 | typedef vector VI; 54 | typedef vector VPII; 55 | 56 | int DP[1000001]; 57 | int A[1000001]; 58 | 59 | int main() 60 | { 61 | int N; si(N); 62 | for(int i = 1; i<=N; i++) 63 | si(A[i]); 64 | DP[0] = 0; 65 | for(int i = 1; i<=N; i++) 66 | DP[i] = max(DP[i-1] , A[i] + (i>=3 ? DP[i-3] : 0)); 67 | cout< 2 | #define assn(n,a,b) assert(n<=b and n>=a) 3 | #define pb push_back 4 | #define mp make_pair 5 | #define F first 6 | #define S second 7 | #define SZ(a) (int)(a.size()) 8 | #define SET(a,b) memset(a,b,sizeof(a)) 9 | #define LET(x,a) __typeof(a) x(a) 10 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 11 | #define repi(i,n) for(int i=0; i<(int)n;i++) 12 | #define sd(n) scanf("%d",&n) 13 | #define sl(n) scanf("%lld",&n) 14 | #define sortv(a) sort(a.begin(),a.end()) 15 | #define all(a) a.begin(),a.end() 16 | #define DRT() int t; cin>>t; while(t--) 17 | using namespace std; 18 | 19 | //FILE *fin = freopen("in","r",stdin); 20 | //FILE *fout = freopen("out","w",stdout); 21 | 22 | #define TRACE 23 | #ifdef TRACE 24 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 25 | template 26 | void __f(const char* name, Arg1&& arg1){ 27 | cerr << name << " : " << arg1 << std::endl; 28 | } 29 | template 30 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 31 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 32 | } 33 | #else 34 | #define trace(...) 35 | #endif 36 | 37 | typedef long long LL; 38 | typedef pair PII; 39 | typedef vector VI; 40 | typedef vector< PII > VPII; 41 | 42 | #define MOD 1000000007ll 43 | LL mpow(LL a, LL n) 44 | {LL ret=1;LL b=a;while(n) {if(n&1) 45 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 46 | return (LL)ret;} 47 | 48 | #define MAXN 1000009 49 | int ar[MAXN]; 50 | 51 | int main() 52 | { 53 | int n,m; 54 | sd(n),sd(m); 55 | for(int i=0; i 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | #define si(x) scanf("%d",&x) 14 | #define PB push_back 15 | #define MP make_pair 16 | 17 | 18 | typedef long long LL; 19 | typedef pair PII; 20 | typedef vector VI; 21 | typedef vector VPII; 22 | 23 | int g; 24 | int tm; 25 | VI E[100000]; 26 | string A; 27 | LL L[100000]; 28 | int S[50000]; 29 | void dfs(int x) 30 | { 31 | S[x] = 1; 32 | L[x] = g; 33 | g++; 34 | while(A[g] != ')') 35 | { 36 | int y = ++tm; 37 | E[x].PB(y); 38 | dfs(y); 39 | S[x] += S[y]; 40 | } 41 | g++; 42 | L[x] = g - L[x]; 43 | } 44 | 45 | int main() 46 | { 47 | tm = 0; 48 | g=0; 49 | LL ans = 0; 50 | cin>>A; 51 | dfs(0); 52 | int N = A.size() / 2; 53 | // for(int i=0; i 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | #define si(x) scanf("%d",&x) 14 | #define F first 15 | #define S second 16 | #define PB push_back 17 | #define MP make_pair 18 | 19 | 20 | typedef long long LL; 21 | typedef pair PII; 22 | typedef vector VI; 23 | typedef vector VPII; 24 | 25 | 26 | 27 | int A[15]; 28 | int N; 29 | VI valid[1<<15]; 30 | bool DP[1<<15]; 31 | 32 | 33 | 34 | int main() 35 | { 36 | cin>>N; 37 | for(int i=0; i>A[i]; 39 | sort(A,A+N); 40 | for(int i=0; i 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | #define si(x) scanf("%d",&x) 14 | #define F first 15 | #define S second 16 | #define PB push_back 17 | #define MP make_pair 18 | 19 | 20 | typedef long long LL; 21 | typedef pair PII; 22 | typedef vector VI; 23 | typedef vector VPII; 24 | 25 | LL A[100][100]; 26 | LL S[100]; 27 | LL S2[100]; 28 | LL D[100]; 29 | LL DS; 30 | int main() 31 | { 32 | int N; cin>>N; 33 | for(int i=0; i>A[i][j]; S[i] += A[i][j]; 37 | } 38 | if(N>1){ 39 | for(int i=0; i 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | #define si(x) scanf("%d",&x) 14 | #define F first 15 | #define S second 16 | #define PB push_back 17 | #define MP make_pair 18 | 19 | 20 | typedef long long LL; 21 | typedef pair PII; 22 | typedef vector VI; 23 | typedef vector VPII; 24 | 25 | 26 | int main() 27 | { 28 | int c0 = 0; 29 | string A; cin>>A; for(auto c : A) c0 += (c=='0'); 30 | int N = A.length(); N-=c0; 31 | cout< 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | #define si(x) scanf("%d",&x) 13 | #define F first 14 | #define S second 15 | #define PB push_back 16 | #define MP make_pair 17 | 18 | 19 | typedef long long LL; 20 | typedef pair PII; 21 | typedef vector VI; 22 | typedef vector VPII; 23 | 24 | 25 | 26 | void add(string a, string b, string &c) 27 | { 28 | c = ""; 29 | int cr = 0; 30 | for(int i=0; i>a>>b>>c; 43 | reverse(a.begin(),a.end()); 44 | reverse(b.begin(),b.end()); 45 | reverse(c.begin(),c.end()); 46 | string aa; add(a,a,aa); 47 | string ab; add(a,b,ab); 48 | string ac; add(a,c,ac); 49 | string bb; add(b,b,bb); 50 | string bc; add(b,c,bc); 51 | string cc; add(c,c,cc); 52 | if(aa==b or aa==c or ab==c or ac==b or bb==a or bb==c or bc==a or cc == a or cc== b)cout<<"YES\n"; else cout<<"NO\n"; 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /100735/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100735/a.out -------------------------------------------------------------------------------- /100735/in: -------------------------------------------------------------------------------- 1 | (()()) 2 | -------------------------------------------------------------------------------- /100735/in2: -------------------------------------------------------------------------------- 1 | (()(())) 2 | -------------------------------------------------------------------------------- /100739/B.cpp: -------------------------------------------------------------------------------- 1 | // karanaggarwal 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | using namespace std; 16 | 17 | #define TRACE 18 | #ifdef TRACE 19 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 20 | template 21 | void __f(const char* name, Arg1&& arg1){ 22 | cerr << name << " : " << arg1 << std::endl; 23 | } 24 | template 25 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 26 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 27 | } 28 | #else 29 | #define trace(...) 30 | #endif 31 | 32 | #define si(x) scanf("%d",&x) 33 | #define F first 34 | #define S second 35 | #define PB push_back 36 | #define MP make_pair 37 | 38 | 39 | typedef long long LL; 40 | typedef pair PII; 41 | typedef vector VI; 42 | typedef vector VPII; 43 | const int P = 300; 44 | int A[P+1][P]; 45 | int B[100000]; 46 | int main() 47 | { 48 | int n,m; si(n); si(m); 49 | for(int i=0; i=p) 65 | { 66 | printf("0\n"); continue; 67 | } 68 | int ans = 0; 69 | if(p<=P) 70 | ans = A[p][q]; 71 | else 72 | for(int i = q; i 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | #define si(x) scanf("%d",&x) 13 | #define F first 14 | #define S second 15 | #define PB push_back 16 | #define MP make_pair 17 | 18 | 19 | typedef long long LL; 20 | typedef pair PII; 21 | typedef vector VI; 22 | typedef vector VPII; 23 | 24 | const int M = 10; 25 | const int N = 10000; 26 | LL BIT[M][N+1]; 27 | int n,m; 28 | 29 | void update(int idx, int mod, LL val) 30 | { 31 | while(idx<=n) 32 | { 33 | BIT[mod][idx] += val; 34 | idx += (idx & (-idx)); 35 | } 36 | } 37 | 38 | LL query(int idx, int mod) 39 | { 40 | LL ret = 0; 41 | while(idx>0) 42 | { 43 | ret += BIT[mod][idx]; 44 | idx = idx & (idx-1); 45 | } 46 | return ret; 47 | } 48 | 49 | LL A[N+1]; 50 | int main() 51 | { 52 | si(n); si(m); 53 | for(int i=1; i<=n; i++) 54 | { 55 | scanf("%lld",&A[i]); 56 | int mod = A[i] % m; 57 | update(i,mod,A[i]); 58 | } 59 | int q; si(q); while(q--) 60 | { 61 | string ch; cin>>ch; 62 | if(ch[0]=='+' or ch[0]=='-') 63 | { 64 | 65 | int idx,val; 66 | scanf("%d%d",&idx,&val); 67 | if(ch[0]=='-')val = -val; 68 | if(val + A[idx] >= 0) 69 | { 70 | update(idx,A[idx] % m, -A[idx]); 71 | A[idx] += val; 72 | update(idx, A[idx] % m, A[idx]); 73 | } 74 | printf("%lld\n",A[idx]); 75 | } 76 | else 77 | { 78 | int l,r,mod; 79 | scanf("%d%d%d",&l,&r,&mod); l--; 80 | printf("%lld\n", query(r,mod) - query(l,mod)); 81 | } 82 | } 83 | return 0; 84 | } 85 | -------------------------------------------------------------------------------- /100741/B.cpp: -------------------------------------------------------------------------------- 1 | // karanaggarwal 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | #define si(x) scanf("%d",&x) 13 | #define F first 14 | #define S second 15 | #define PB push_back 16 | #define MP make_pair 17 | 18 | 19 | typedef long long LL; 20 | typedef pair PII; 21 | typedef vector VI; 22 | typedef vector VPII; 23 | 24 | 25 | 26 | const int N = 100000; 27 | int n; 28 | unordered_map mp; 29 | string mp_name[N]; 30 | VI E[N]; 31 | bool V[N]; 32 | 33 | vector TP; 34 | 35 | 36 | void dfs(int x) 37 | { 38 | if(V[x])return; 39 | V[x] = true; 40 | int nn = E[x].size(); 41 | for(int i = nn-1; i>=0; i--) 42 | dfs(E[x][i]); 43 | TP.PB(x); 44 | } 45 | 46 | 47 | int main() 48 | { 49 | cin>>n; 50 | for(int i=0; i>ch>>name; 54 | mp[name] = i; 55 | while(1) 56 | { 57 | cin>>ch>>name; 58 | if(ch=="with") 59 | E[i].PB(mp[name]); 60 | else 61 | { 62 | mp_name[i] = name; 63 | break; 64 | } 65 | } 66 | } 67 | string name; 68 | cin>>name; 69 | int source = mp[name]; 70 | dfs(source); 71 | int nn = TP.size(); 72 | for(int i = nn-1; i>=0; i--) 73 | cout< 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | #define si(x) scanf("%d",&x) 14 | #define F first 15 | #define S second 16 | #define PB push_back 17 | #define MP make_pair 18 | 19 | 20 | typedef long long LL; 21 | typedef pair PII; 22 | typedef vector VI; 23 | typedef vector VPII; 24 | 25 | 26 | int main() 27 | { 28 | int N; int x = 0; 29 | cin>>N; 30 | while(N--) 31 | { 32 | int y; si(y); x^=y; 33 | } 34 | cout< 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | #define si(x) scanf("%d",&x) 13 | #define F first 14 | #define S second 15 | #define PB push_back 16 | #define MP make_pair 17 | 18 | 19 | typedef long long LL; 20 | typedef pair PII; 21 | typedef vector VI; 22 | typedef vector VPII; 23 | 24 | #define sqr(x) ((x) * (x)) 25 | 26 | inline int cmp(double a, double b) 27 | { 28 | return (fabs(a-b) < eps) ? 0 : ((a < b) ? -1 : 1); 29 | } 30 | struct Point { 31 | double x, y; 32 | Point(double x = 0.0, double y = 0.0) : x(x), y(y) {} 33 | 34 | Point operator + (Point a) { return Point(x+a.x, y+a.y); } 35 | Point operator - (Point a) { return Point(x-a.x, y-a.y); } 36 | Point operator * (ll k) { return Point(x*k, y*k); } 37 | 38 | double operator * (Point a) { return x*a.x + y*a.y; } // dot product 39 | double operator % (Point a) { return x*a.y - y*a.x; } // cross product 40 | 41 | int cmp(Point q) const { if (int t = ::cmp(x,q.x)) return t; return ::cmp(y,q.y); } 42 | 43 | #define Comp(x) bool operator x (Point q) const { return cmp(q) x 0; } 44 | Comp(>) Comp(<) Comp(==) Comp(>=) Comp(<=) Comp(!=) 45 | #undef Comp 46 | 47 | Point conj() { return Point(x, -y); } 48 | double norm() { return x*x + y*y; } 49 | }; 50 | 51 | int ccw(Point a, Point b, Point c) { 52 | return cmp((b-a)%(c-a),0); 53 | } 54 | 55 | ll area2(Point a, Point b, Point c) { return a%b + b%c + c%a; } 56 | 57 | 58 | Point P[1001],L[1000]; 59 | 60 | int main() 61 | { 62 | int n,m; cin>>n>>m; 63 | for(int i=0; i>P[i].x>>P[i].y; 65 | for(int i=0; i>L[i].x>>L[i].y; 67 | P[n] = P[0]; 68 | 69 | return 0; 70 | } 71 | -------------------------------------------------------------------------------- /100741/H.cpp: -------------------------------------------------------------------------------- 1 | // karanaggarwal 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | using namespace std; 11 | 12 | #define si(x) scanf("%d",&x) 13 | #define F first 14 | #define S second 15 | #define PB push_back 16 | #define MP make_pair 17 | 18 | 19 | typedef long long LL; 20 | typedef pair PII; 21 | typedef vector VI; 22 | typedef vector VPII; 23 | 24 | 25 | LL W,H,R; 26 | 27 | double sq(LL x){return x*x;} 28 | const double eps = 1e-6; 29 | int f(double d) 30 | { 31 | if(d>=2*R)return H/(2*R); 32 | if(d>W>>H>>R; 43 | W*=2; H*=2; 44 | LL nW = W - 2*R; 45 | long long ans = 0; 46 | if(W<2*R or H<2*R)ans = 0; else ans = 1; 47 | if(nW==0)ans=max(ans,H/(2*R)); 48 | // cout<0) 51 | { 52 | for(int d = 1; ; d++) 53 | { 54 | int dd = d; 55 | int cn = f(((double)nW) / dd); 56 | // cout<0) 67 | { 68 | for(int d = 1; ; d++) 69 | { 70 | int dd = d; 71 | int cn = f(((double)nW) / dd); 72 | if(cn==0)break; 73 | ans = max(ans , (1 + d) * (LL)cn); 74 | d = dd; 75 | } 76 | } 77 | cout< 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace std; 12 | 13 | #define si(x) scanf("%d",&x) 14 | #define F first 15 | #define S second 16 | #define PB push_back 17 | #define MP make_pair 18 | 19 | 20 | typedef long long LL; 21 | typedef pair PII; 22 | typedef vector VI; 23 | typedef vector VPII; 24 | 25 | unordered_map M; 26 | int A[17]; 27 | int main() 28 | { 29 | int n,m; cin>>n>>m; 30 | for(int i=0; i>A[i]; 32 | for(int mask = 1; mask < (1<>A[i]; 44 | for(int mask = 1; mask < (1< 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleIdentifier 8 | com.apple.xcode.dsym.a.out 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | dSYM 13 | CFBundleSignature 14 | ???? 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleVersion 18 | 1 19 | 20 | 21 | -------------------------------------------------------------------------------- /100741/a.out.dSYM/Contents/Resources/DWARF/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100741/a.out.dSYM/Contents/Resources/DWARF/a.out -------------------------------------------------------------------------------- /100741/in: -------------------------------------------------------------------------------- 1 | 2 4 2 | 1 2 3 | 2 2 4 | 1 1 2 1 5 | 1 1 1 2 6 | 1 1 2 2 7 | 2 2 2 2 8 | -------------------------------------------------------------------------------- /100765/B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #define rep(i,N) for(int (i)=0;(i)<(N);(i)++) 16 | #define repi(i,j,N) for(int (i)=(j);(i)<(N);(i)++) 17 | #define repg(i,j,N) for((i)=(j);(i)<(N);(i)++) 18 | #define si(i) scanf("%d",&(i)) 19 | #define sl(i) scanf("%lld",&(i)) 20 | #define pi(i) printf("%d",(i)) 21 | #define pl(i) printf("%lld",(i)) 22 | #define pin(i) printf("%d\n",(i)) 23 | #define pln(i) printf("%lld\n",(i)) 24 | #define pw printf(" "); 25 | #define pn printf("\n"); 26 | 27 | using namespace std; 28 | 29 | typedef vector vi; 30 | typedef vector vvi; 31 | typedef pair ii; 32 | #define sz(a) int((a).size()) 33 | #define PB push_back 34 | #define MP make_pair 35 | #define F first 36 | #define S second 37 | #define all(c) (c).begin(),(c).end() 38 | #define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++) 39 | #define present(c,x) ((c).find(x) != (c).end()) 40 | #define cpresent(c,x) (find(all(c),x) != (c).end()) 41 | 42 | 43 | 44 | int main() 45 | { 46 | clock_t startTime = clock(); 47 | ios_base::sync_with_stdio(false); 48 | int N,M; 49 | cin>>N>>M; 50 | int sum=0; 51 | rep(i,M) 52 | { 53 | int tmp; 54 | cin>>tmp; 55 | sum=(sum+(tmp%N))%N; 56 | } 57 | cout< 2 | #define assn(n,a,b) assert(n<=b and n>=a) 3 | #define pb push_back 4 | #define mp make_pair 5 | #define F first 6 | #define S second 7 | #define SZ(a) (int)(a.size()) 8 | #define SET(a,b) memset(a,b,sizeof(a)) 9 | #define LET(x,a) __typeof(a) x(a) 10 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 11 | #define repi(i,n) for(int i=0; i<(int)n;i++) 12 | #define sd(n) scanf("%d",&n) 13 | #define sl(n) scanf("%lld",&n) 14 | #define sortv(a) sort(a.begin(),a.end()) 15 | #define all(a) a.begin(),a.end() 16 | #define DRT() int t; cin>>t; while(t--) 17 | using namespace std; 18 | 19 | //FILE *fin = freopen("in","r",stdin); 20 | //FILE *fout = freopen("out","w",stdout); 21 | 22 | #define TRACE 23 | #ifdef TRACE 24 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 25 | template 26 | void __f(const char* name, Arg1&& arg1){ 27 | cerr << name << " : " << arg1 << std::endl; 28 | } 29 | template 30 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 31 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 32 | } 33 | #else 34 | #define trace(...) 35 | #endif 36 | 37 | typedef long long LL; 38 | typedef pair PII; 39 | typedef vector VI; 40 | typedef vector< PII > VPII; 41 | 42 | #define MOD 1000000007ll 43 | LL mpow(LL a, LL n) 44 | {LL ret=1;LL b=a;while(n) {if(n&1) 45 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 46 | return (LL)ret;} 47 | 48 | int main() 49 | { 50 | int ans=0; 51 | string s; 52 | cin >> s; 53 | for(int i=0; i 2 | #define assn(n,a,b) assert(n<=b and n>=a) 3 | #define pb push_back 4 | #define mp make_pair 5 | #define F first 6 | #define S second 7 | #define SZ(a) (int)(a.size()) 8 | #define SET(a,b) memset(a,b,sizeof(a)) 9 | #define LET(x,a) __typeof(a) x(a) 10 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 11 | #define repi(i,n) for(int i=0; i<(int)n;i++) 12 | #define sd(n) scanf("%d",&n) 13 | #define sl(n) scanf("%lld",&n) 14 | #define sortv(a) sort(a.begin(),a.end()) 15 | #define all(a) a.begin(),a.end() 16 | #define DRT() int t; cin>>t; while(t--) 17 | using namespace std; 18 | 19 | //FILE *fin = freopen("in","r",stdin); 20 | //FILE *fout = freopen("out","w",stdout); 21 | 22 | #define TRACE 23 | #ifdef TRACE 24 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 25 | template 26 | void __f(const char* name, Arg1&& arg1){ 27 | cerr << name << " : " << arg1 << std::endl; 28 | } 29 | template 30 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 31 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 32 | } 33 | #else 34 | #define trace(...) 35 | #endif 36 | 37 | typedef long long LL; 38 | typedef pair PII; 39 | typedef vector VI; 40 | typedef vector< PII > VPII; 41 | 42 | #define MOD 1000000007ll 43 | LL mpow(LL a, LL n) 44 | {LL ret=1;LL b=a;while(n) {if(n&1) 45 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 46 | return (LL)ret;} 47 | 48 | int ar[110009]; 49 | 50 | int main() 51 | { 52 | int n,k,ans=0,st; 53 | sd(n),sd(k); 54 | for(int i=0; i0)); 61 | cout << ans << endl; 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /100792/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define assn(n,a,b) assert(n<=b and n>=a) 3 | #define pb push_back 4 | #define mp make_pair 5 | #define F first 6 | #define S second 7 | #define SZ(a) (int)(a.size()) 8 | #define SET(a,b) memset(a,b,sizeof(a)) 9 | #define LET(x,a) __typeof(a) x(a) 10 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 11 | #define repi(i,n) for(int i=0; i<(int)n;i++) 12 | #define sd(n) scanf("%d",&n) 13 | #define sl(n) scanf("%lld",&n) 14 | #define sortv(a) sort(a.begin(),a.end()) 15 | #define all(a) a.begin(),a.end() 16 | #define DRT() int t; cin>>t; while(t--) 17 | using namespace std; 18 | 19 | //FILE *fin = freopen("in","r",stdin); 20 | //FILE *fout = freopen("out","w",stdout); 21 | 22 | #define TRACE 23 | #ifdef TRACE 24 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 25 | template 26 | void __f(const char* name, Arg1&& arg1){ 27 | cerr << name << " : " << arg1 << std::endl; 28 | } 29 | template 30 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 31 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 32 | } 33 | #else 34 | #define trace(...) 35 | #endif 36 | 37 | typedef long long LL; 38 | typedef pair PII; 39 | typedef vector VI; 40 | typedef vector< PII > VPII; 41 | 42 | #define MOD 1000000007ll 43 | LL mpow(LL a, LL n) 44 | {LL ret=1;LL b=a;while(n) {if(n&1) 45 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 46 | return (LL)ret;} 47 | 48 | int main() 49 | { 50 | int n; 51 | sd(n); 52 | n--; 53 | VI ans; 54 | for(int i=1; i*i<=n; i++){ 55 | if(n%i==0)ans.pb(i),ans.pb(n/i); 56 | if(i*i==n)ans.pop_back(); 57 | } 58 | sort(all(ans)); 59 | for(auto &j: ans) 60 | printf("%d ",j); 61 | return 0; 62 | } 63 | 64 | 65 | -------------------------------------------------------------------------------- /100792/D.cpp: -------------------------------------------------------------------------------- 1 | // heuristics 2 | #ifdef __APPLE__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #else 22 | 23 | #include 24 | 25 | #endif // __APPLE__ 26 | 27 | using namespace std; 28 | 29 | #define TRACE 30 | #ifdef TRACE 31 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 32 | template 33 | void __f(const char* name, Arg1&& arg1){ 34 | cerr << name << " : " << arg1 << std::endl; 35 | } 36 | template 37 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 38 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 39 | } 40 | #else 41 | #define trace(...) 42 | #endif 43 | 44 | #define si(x) scanf("%d",&x) 45 | #define F first 46 | #define S second 47 | #define PB push_back 48 | #define MP make_pair 49 | 50 | 51 | typedef long long LL; 52 | typedef pair PII; 53 | typedef vector VI; 54 | typedef vector VPII; 55 | 56 | double sq(double x){ return x*x;} 57 | int main() 58 | { 59 | double h1,h2,t1,t2; 60 | cin>>h1>>t1>>h2>>t2; 61 | double g = 2 * sq( ( sqrt(h1) - sqrt(h2)) / (t1-t2) ); 62 | double act = sqrt( (2*h1) / g ); 63 | printf("%.6lf\n", t1 - act); 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /100792/I.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #define rep(i,N) for(int (i)=0;(i)<(N);(i)++) 17 | #define repi(i,j,N) for(int (i)=(j);(i)<(N);(i)++) 18 | #define repg(i,j,N) for((i)=(j);(i)<(N);(i)++) 19 | #define si(i) scanf("%d",&(i)) 20 | #define sl(i) scanf("%lld",&(i)) 21 | #define pi(i) printf("%d",(i)) 22 | #define pl(i) printf("%lld",(i)) 23 | #define pin(i) printf("%d\n",(i)) 24 | #define pln(i) printf("%lld\n",(i)) 25 | #define pw printf(" "); 26 | #define pn printf("\n"); 27 | 28 | using namespace std; 29 | 30 | typedef vector vi; 31 | typedef vector vvi; 32 | typedef pair ii; 33 | #define sz(a) int((a).size()) 34 | #define PB push_back 35 | #define MP make_pair 36 | #define F first 37 | #define S second 38 | #define all(c) (c).begin(),(c).end() 39 | #define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++) 40 | #define present(c,x) ((c).find(x) != (c).end()) 41 | #define cpresent(c,x) (find(all(c),x) != (c).end()) 42 | 43 | 44 | 45 | int main() 46 | { 47 | clock_t startTime = clock(); 48 | ios_base::sync_with_stdio(false); 49 | int N; 50 | cin>>N; 51 | vector > trp; 52 | rep(i,N) 53 | { 54 | int a,b; 55 | cin>>a>>b; 56 | trp.PB(MP(a,b)); 57 | } 58 | for(int i=1; i<=1826; i++) 59 | { 60 | int cur = 0; 61 | for(int j=0; j0) 66 | cur+=end-st+1; 67 | } 68 | if(cur>90) 69 | { 70 | cout<<"No"< 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #else 22 | 23 | #include 24 | 25 | #endif // __APPLE__ 26 | 27 | using namespace std; 28 | 29 | #define TRACE 30 | #ifdef TRACE 31 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 32 | template 33 | void __f(const char* name, Arg1&& arg1){ 34 | cerr << name << " : " << arg1 << std::endl; 35 | } 36 | template 37 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 38 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 39 | } 40 | #else 41 | #define trace(...) 42 | #endif 43 | 44 | #define si(x) scanf("%d",&x) 45 | #define F first 46 | #define S second 47 | #define PB push_back 48 | #define MP make_pair 49 | 50 | 51 | typedef long long LL; 52 | typedef pair PII; 53 | typedef vector VI; 54 | typedef vector VPII; 55 | 56 | string A,B; 57 | 58 | int main() 59 | { 60 | cin>>A>>B; 61 | for(int i = 0; i 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #else 22 | 23 | #include 24 | 25 | #endif // __APPLE__ 26 | 27 | using namespace std; 28 | 29 | #define TRACE 30 | #ifdef TRACE 31 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 32 | template 33 | void __f(const char* name, Arg1&& arg1){ 34 | cerr << name << " : " << arg1 << std::endl; 35 | } 36 | template 37 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 38 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 39 | } 40 | #else 41 | #define trace(...) 42 | #endif 43 | 44 | #define si(x) scanf("%d",&x) 45 | #define F first 46 | #define S second 47 | #define PB push_back 48 | #define MP make_pair 49 | 50 | 51 | typedef long long LL; 52 | typedef pair PII; 53 | typedef vector VI; 54 | typedef vector VPII; 55 | 56 | string A; 57 | string mv; 58 | int main() 59 | { 60 | int N,x; cin>>N>>x>>A; 61 | int m; cin>>m>>mv; 62 | int cr = x-1; 63 | cout< 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #else 22 | 23 | #include 24 | 25 | #endif // __APPLE__ 26 | 27 | using namespace std; 28 | 29 | #define TRACE 30 | #ifdef TRACE 31 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 32 | template 33 | void __f(const char* name, Arg1&& arg1){ 34 | cerr << name << " : " << arg1 << std::endl; 35 | } 36 | template 37 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 38 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 39 | } 40 | #else 41 | #define trace(...) 42 | #endif 43 | 44 | #define si(x) scanf("%d",&x) 45 | #define F first 46 | #define S second 47 | #define PB push_back 48 | #define MP make_pair 49 | 50 | 51 | typedef long long LL; 52 | typedef pair PII; 53 | typedef vector VI; 54 | typedef vector VPII; 55 | 56 | 57 | LL nc2(LL x) 58 | { 59 | x *= (x+1); return x/2; 60 | } 61 | 62 | int main() 63 | { 64 | LL n,m; cin>>n>>m; 65 | if(n>m)swap(n,m); 66 | LL nn = 1; LL nm = m - (n-1); 67 | LL ans = 1 + nm ; 68 | ans += nc2(n) - nc2(nn); 69 | ans += nc2(m) - nc2(nm); 70 | cout< 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #else 22 | 23 | #include 24 | 25 | #endif // __APPLE__ 26 | 27 | using namespace std; 28 | 29 | #define TRACE 30 | #ifdef TRACE 31 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 32 | template 33 | void __f(const char* name, Arg1&& arg1){ 34 | cerr << name << " : " << arg1 << std::endl; 35 | } 36 | template 37 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 38 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 39 | } 40 | #else 41 | #define trace(...) 42 | #endif 43 | 44 | #define si(x) scanf("%d",&x) 45 | #define F first 46 | #define S second 47 | #define PB push_back 48 | #define MP make_pair 49 | 50 | 51 | typedef long long LL; 52 | typedef pair PII; 53 | typedef vector VI; 54 | typedef vector VPII; 55 | 56 | 57 | int main() 58 | { 59 | double r,R,x; 60 | cin>>r>>R>>x; 61 | double h = x/( (R/r) - 1 ); 62 | double theta = (atan2(h,r) )/(2.0); 63 | double lim = (R*tan(theta)); 64 | lim = min(lim,x/2); 65 | printf("%.11lf\n",lim); 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /100796/L.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #define assn(n,a,b) assert(n<=b and n>=a) 3 | #define pb push_back 4 | #define mp make_pair 5 | #define F first 6 | #define S second 7 | #define SZ(a) (int)(a.size()) 8 | #define SET(a,b) memset(a,b,sizeof(a)) 9 | #define LET(x,a) __typeof(a) x(a) 10 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 11 | #define repi(i,n) for(int i=0; i<(int)n;i++) 12 | #define sd(n) scanf("%d",&n) 13 | #define sl(n) scanf("%lld",&n) 14 | #define sortv(a) sort(a.begin(),a.end()) 15 | #define all(a) a.begin(),a.end() 16 | #define DRT() int t; cin>>t; while(t--) 17 | using namespace std; 18 | 19 | //FILE *fin = freopen("in","r",stdin); 20 | //FILE *fout = freopen("out","w",stdout); 21 | 22 | #define TRACE 23 | #ifdef TRACE 24 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 25 | template 26 | void __f(const char* name, Arg1&& arg1){ 27 | cerr << name << " : " << arg1 << std::endl; 28 | } 29 | template 30 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 31 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 32 | } 33 | #else 34 | #define trace(...) 35 | #endif 36 | 37 | typedef long long LL; 38 | typedef pair PII; 39 | typedef vector VI; 40 | typedef vector< PII > VPII; 41 | 42 | #define MOD 1000000007ll 43 | LL mpow(LL a, LL n) 44 | {LL ret=1;LL b=a;while(n) {if(n&1) 45 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 46 | return (LL)ret;} 47 | 48 | int main() 49 | { 50 | int n; 51 | cin >> n; 52 | string s; 53 | cin >> s; 54 | int a=0,b=0; 55 | for(int i=0; ib)printf("HAPPY\n"); 62 | else if(b>a)printf("SAD\n"); 63 | else printf("BORED\n"); 64 | return 0; 65 | } 66 | 67 | 68 | -------------------------------------------------------------------------------- /100800/B.cpp: -------------------------------------------------------------------------------- 1 | #ifdef __APPLE__ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #else 21 | 22 | #include 23 | 24 | #endif // __APPLE__ 25 | 26 | using namespace std; 27 | 28 | #define TRACE 29 | #ifdef TRACE 30 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 31 | template 32 | void __f(const char* name, Arg1&& arg1){ 33 | cerr << name << " : " << arg1 << std::endl; 34 | } 35 | template 36 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 37 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 38 | } 39 | #else 40 | #define trace(...) 41 | #endif 42 | 43 | #define si(x) scanf("%d",&x) 44 | #define F first 45 | #define S second 46 | #define PB push_back 47 | #define MP make_pair 48 | #define REP(i,a,b) for(int i = (int)a; i < (int)b; i++) 49 | 50 | 51 | typedef long long LL; 52 | typedef pair PII; 53 | typedef vector VI; 54 | typedef vector VPII; 55 | 56 | #define PI 3.14159265359 57 | 58 | int main() 59 | { 60 | int n; 61 | double g,d[5],theta[5],a[5],u[5],v[5]; 62 | cin >>n >> g; 63 | for(int i=0; i> d[i] >> theta[i]; 65 | a[i]=g*cos((theta[i]/180.0)*PI); 66 | } 67 | for(int i=0; i 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #else 22 | 23 | #include 24 | 25 | #endif // __APPLE__ 26 | 27 | using namespace std; 28 | 29 | #define TRACE 30 | #ifdef TRACE 31 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 32 | template 33 | void __f(const char* name, Arg1&& arg1){ 34 | cerr << name << " : " << arg1 << std::endl; 35 | } 36 | template 37 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 38 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 39 | } 40 | #else 41 | #define trace(...) 42 | #endif 43 | 44 | #define si(x) scanf("%d",&x) 45 | #define F first 46 | #define S second 47 | #define PB push_back 48 | #define MP make_pair 49 | 50 | 51 | typedef long long LL; 52 | typedef pair PII; 53 | typedef vector VI; 54 | typedef vector VPII; 55 | 56 | double ans(int h, int w) 57 | { 58 | double ans=0.0; 59 | ans=max(ans, min((double)w,((double)h)/3)); 60 | ans=max(ans, min(((double)h)/2, ((double)w)/2)); 61 | return ans; 62 | } 63 | 64 | int main() 65 | { 66 | FILE *fin = freopen("alex.in","r",stdin); 67 | FILE *fout = freopen("alex.out","w",stdout); 68 | int h,w; 69 | cin>>h>>w; 70 | cout< 2 | #define assn(n,a,b) assert(n<=b and n>=a) 3 | #define pb push_back 4 | #define mp make_pair 5 | #define F first 6 | #define S second 7 | #define SZ(a) (int)(a.size()) 8 | #define SET(a,b) memset(a,b,sizeof(a)) 9 | #define LET(x,a) __typeof(a) x(a) 10 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 11 | #define repi(i,n) for(int i=0; i<(int)n;i++) 12 | #define sd(n) scanf("%d",&n) 13 | #define sl(n) scanf("%lld",&n) 14 | #define sortv(a) sort(a.begin(),a.end()) 15 | #define all(a) a.begin(),a.end() 16 | #define DRT() int t; cin>>t; while(t--) 17 | using namespace std; 18 | 19 | FILE *fin = freopen("hash.in","r",stdin); 20 | FILE *fout = freopen("hash.out","w",stdout); 21 | 22 | #define TRACE 23 | #ifdef TRACE 24 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 25 | template 26 | void __f(const char* name, Arg1&& arg1){ 27 | cerr << name << " : " << arg1 << std::endl; 28 | } 29 | template 30 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 31 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 32 | } 33 | #else 34 | #define trace(...) 35 | #endif 36 | 37 | typedef long long LL; 38 | typedef pair PII; 39 | typedef vector VI; 40 | typedef vector< PII > VPII; 41 | 42 | #define MOD 1000000007ll 43 | LL mpow(LL a, LL n) 44 | {LL ret=1;LL b=a;while(n) {if(n&1) 45 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 46 | return (LL)ret;} 47 | 48 | char s[1009]; 49 | 50 | int main() 51 | { 52 | int k; 53 | sd(k); 54 | for(int i=0; i 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #else 21 | 22 | #include 23 | 24 | #endif // __APPLE__ 25 | 26 | using namespace std; 27 | 28 | #define TRACE 29 | #ifdef TRACE 30 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 31 | template 32 | void __f(const char* name, Arg1&& arg1){ 33 | cerr << name << " : " << arg1 << std::endl; 34 | } 35 | template 36 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 37 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 38 | } 39 | #else 40 | #define trace(...) 41 | #endif 42 | 43 | #define si(x) scanf("%d",&x) 44 | #define F first 45 | #define S second 46 | #define PB push_back 47 | #define MP make_pair 48 | #define REP(i,a,b) for(int i = (int)a; i < (int)b; i++) 49 | 50 | 51 | typedef long long LL; 52 | typedef pair PII; 53 | typedef vector VI; 54 | typedef vector VPII; 55 | 56 | PII A[1000]; 57 | 58 | int main() 59 | { 60 | int N,m; cin>>N>>m; 61 | for(int i = 0; i>A[i].F>>A[i].S; 63 | 64 | sort(A,A+m); 65 | 66 | int ans = N+1; 67 | 68 | int r = 0; 69 | int l = 0; 70 | for(int i = 0; i r) 73 | { 74 | ans += 2*(r-l); 75 | l = A[i].F; r = A[i].S; 76 | } 77 | else 78 | { 79 | r = max(r,A[i].S); 80 | } 81 | } 82 | ans += 2*(r-l); 83 | cout< 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #else 21 | 22 | #include 23 | 24 | #endif // __APPLE__ 25 | 26 | using namespace std; 27 | 28 | #define TRACE 29 | #ifdef TRACE 30 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 31 | template 32 | void __f(const char* name, Arg1&& arg1){ 33 | cerr << name << " : " << arg1 << std::endl; 34 | } 35 | template 36 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 37 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 38 | } 39 | #else 40 | #define trace(...) 41 | #endif 42 | 43 | #define si(x) scanf("%d",&x) 44 | #define F first 45 | #define S second 46 | #define PB push_back 47 | #define MP make_pair 48 | #define REP(i,a,b) for(int i = (int)a; i < (int)b; i++) 49 | 50 | 51 | typedef long long LL; 52 | typedef pair PII; 53 | typedef vector VI; 54 | typedef vector VPII; 55 | int A[100000]; 56 | int main() 57 | { 58 | int N; cin>>N; 59 | for(int i = 0; i=0; i--) 62 | { 63 | if(A[i]>=N) 64 | { 65 | N--; 66 | } 67 | else 68 | { 69 | break; 70 | } 71 | } 72 | cout< 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #else 21 | 22 | #include 23 | 24 | #endif // __APPLE__ 25 | 26 | using namespace std; 27 | 28 | #define TRACE 29 | #ifdef TRACE 30 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 31 | template 32 | void __f(const char* name, Arg1&& arg1){ 33 | cerr << name << " : " << arg1 << std::endl; 34 | } 35 | template 36 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 37 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 38 | } 39 | #else 40 | #define trace(...) 41 | #endif 42 | 43 | #define si(x) scanf("%d",&x) 44 | #define F first 45 | #define S second 46 | #define PB push_back 47 | #define MP make_pair 48 | #define REP(i,a,b) for(int i = (int)a; i < (int)b; i++) 49 | 50 | 51 | typedef long long LL; 52 | typedef pair PII; 53 | typedef vector VI; 54 | typedef vector VPII; 55 | 56 | string A[3][2]; 57 | 58 | int main() 59 | { 60 | int N = 100000; 61 | A[0][0] = "abc"; A[1][0] = "bca"; A[2][0] = "cab"; 62 | A[0][1] = "cba"; A[1][1] = "acb"; A[2][1] = "bac"; 63 | 64 | string CR = "a"; 65 | while(CR.size() < N) 66 | { 67 | string B = ""; 68 | for(int i = 0; i 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #else 21 | 22 | #include 23 | 24 | #endif // __APPLE__ 25 | 26 | using namespace std; 27 | 28 | #define TRACE 29 | #ifdef TRACE 30 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 31 | template 32 | void __f(const char* name, Arg1&& arg1){ 33 | cerr << name << " : " << arg1 << std::endl; 34 | } 35 | template 36 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 37 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 38 | } 39 | #else 40 | #define trace(...) 41 | #endif 42 | 43 | #define si(x) scanf("%d",&x) 44 | #define F first 45 | #define S second 46 | #define PB push_back 47 | #define MP make_pair 48 | #define REP(i,a,b) for(int i = (int)a; i < (int)b; i++) 49 | 50 | 51 | typedef long long LL; 52 | typedef pair PII; 53 | typedef vector VI; 54 | typedef vector VPII; 55 | 56 | int A[1000000]; 57 | int main() 58 | { 59 | int N,K; si(N); si(K); 60 | for(int i =0; i 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define si(x) scanf("%d",&x) 20 | 21 | int DP[100][100][2]; 22 | int A[100]; 23 | bool f(int i, int j, bool lag) 24 | { 25 | int &dp = DP[i][j][lag]; 26 | if(dp != -1)return dp; 27 | if(i==j){ dp = 1; return dp;} 28 | dp = 0; 29 | if(lag) 30 | { 31 | dp = not f(i,j,false); if(dp)return dp; 32 | } 33 | bool has_one = false; 34 | for(int k = i; k<=j; k++) 35 | { 36 | if(A[k]==1) has_one = true; 37 | if((k==i and A[k+1] 2 | #define assn(n,a,b) assert(n<=b and n>=a) 3 | #define pb push_back 4 | #define mp make_pair 5 | #define PB push_back 6 | #define MP make_pair 7 | #define F first 8 | #define S second 9 | #define SZ(a) (int)(a.size()) 10 | #define SET(a,b) memset(a,b,sizeof(a)) 11 | #define LET(x,a) __typeof(a) x(a) 12 | #define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++) 13 | #define repi(i,n) for(int i=0; i<(int)n;i++) 14 | #define sd(n) scanf("%d",&n) 15 | #define si(n) scanf("%d",&n) 16 | #define sl(n) scanf("%lld",&n) 17 | #define sortv(a) sort(a.begin(),a.end()) 18 | #define all(a) a.begin(),a.end() 19 | using namespace std; 20 | 21 | //FILE *fin = freopen("in","r",stdin); 22 | //FILE *fout = freopen("out","w",stdout); 23 | 24 | #define TRACE 25 | #ifdef TRACE 26 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 27 | template 28 | void __f(const char* name, Arg1&& arg1){ 29 | cerr << name << " : " << arg1 << std::endl; 30 | } 31 | template 32 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 33 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 34 | } 35 | #else 36 | #define trace(...) 37 | #endif 38 | 39 | typedef long long LL; 40 | typedef pair PII; 41 | typedef vector VI; 42 | typedef vector< PII > VPII; 43 | 44 | #define MOD 1000000007ll 45 | LL mpow(LL a, LL n) 46 | {LL ret=1;LL b=a;while(n) {if(n&1) 47 | ret=(ret*b)%MOD;b=(b*b)%MOD;n>>=1;} 48 | return (LL)ret;} 49 | 50 | int main() 51 | { 52 | //ios_base::sync_with_stdio(false); 53 | unsigned short int a=(1<<16)-1; 54 | trace(a); 55 | return 0; 56 | } 57 | 58 | 59 | -------------------------------------------------------------------------------- /100851/.c.cpp (Case Conflict).swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100851/.c.cpp (Case Conflict).swp -------------------------------------------------------------------------------- /100851/E: -------------------------------------------------------------------------------- 1 | K.cpp: In instantiation of ‘void __f(const char*, Arg1&&) [with Arg1 = std::vector&]’: 2 | K.cpp:229:21: required from here 3 | K.cpp:39:27: error: cannot bind ‘std::basic_ostream’ lvalue to ‘std::basic_ostream&&’ 4 | cerr << name << " : " << arg1 << std::endl; 5 | ^ 6 | In file included from /usr/include/c++/4.8/iostream:39:0, 7 | from K.cpp:1: 8 | /usr/include/c++/4.8/ostream:602:5: error: initializing argument 1 of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char; _Traits = std::char_traits; _Tp = std::vector]’ 9 | operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x) 10 | ^ 11 | -------------------------------------------------------------------------------- /100851/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100851/a.out -------------------------------------------------------------------------------- /100851/brute.py: -------------------------------------------------------------------------------- 1 | def getdec(s): 2 | ans=0 3 | cur=1 4 | 5 | for i in s: 6 | if i=='1': 7 | ans += cur 8 | cur = cur*10 9 | 10 | return ans 11 | 12 | def getbin(s): 13 | ans=0 14 | cur=1 15 | 16 | for i in s: 17 | if i=='1': 18 | ans += cur 19 | cur = cur*10 20 | 21 | return ans 22 | 23 | 24 | 25 | for i in range(1, 1<<11): 26 | x=bin(i) 27 | y=getdec(x[2:][::-1]) 28 | l=len(str(y)) 29 | xx=bin(y) 30 | if xx[-l::]==str(y): 31 | p=y 32 | ans=0 33 | cur=1 34 | while p: 35 | if p%10: 36 | ans +=cur 37 | cur = cur*2 38 | p/=10 39 | tempy=y 40 | y/=10 41 | while y%10==0 and y: 42 | y/=10 43 | print tempy,ans,str(y)[::-1] 44 | -------------------------------------------------------------------------------- /100851/cor: -------------------------------------------------------------------------------- 1 | 2 2 | 1 3 | 2 4 | 1 5 | 1 6 | 1 7 | 1 8 | 2 9 | 2 10 | 3 11 | 1 12 | 1 13 | 1 14 | 1 15 | 2 16 | 1 17 | 0 18 | 3 19 | 2 20 | 1 21 | 1 22 | 2 23 | 2 24 | 0 25 | 2 26 | 3 27 | 1 28 | 1 29 | 2 30 | 1 31 | 2 32 | 2 33 | 2 34 | 0 35 | 3 36 | 1 37 | 0 38 | 0 39 | 1 40 | 1 41 | 0 42 | 1 43 | 1 44 | 0 45 | 2 46 | 2 47 | 1 48 | 2 49 | 1 50 | -------------------------------------------------------------------------------- /100851/in: -------------------------------------------------------------------------------- 1 | 7 2 | 4 6 3 | 3 7 4 | 7 4 5 | 7 2 6 | 49 7 | 1 6 8 | 6 7 9 | 1 4 10 | 7 1 11 | 7 3 12 | 4 6 13 | 4 5 14 | 1 4 15 | 6 2 16 | 1 5 17 | 6 5 18 | 3 2 19 | 2 7 20 | 6 7 21 | 4 2 22 | 3 2 23 | 7 7 24 | 2 5 25 | 5 3 26 | 3 7 27 | 3 4 28 | 6 1 29 | 3 1 30 | 5 5 31 | 6 3 32 | 2 5 33 | 4 5 34 | 2 7 35 | 7 5 36 | 6 4 37 | 2 4 38 | 2 6 39 | 5 7 40 | 1 1 41 | 1 5 42 | 4 7 43 | 6 6 44 | 2 2 45 | 2 1 46 | 3 4 47 | 4 4 48 | 1 2 49 | 4 7 50 | 3 3 51 | 3 6 52 | 1 3 53 | 5 6 54 | 3 5 55 | 1 7 56 | -------------------------------------------------------------------------------- /100851/in1: -------------------------------------------------------------------------------- 1 | 1 1 0 2 | 10 2 1 3 | 11 3 1 4 | 100 4 1 5 | 101 5 1 6 | 110 6 11 7 | 111 7 11 8 | 1000 8 1 9 | 1001 9 1 10 | 1100 12 11 11 | 1101 13 11 12 | 10000 16 1 13 | 10001 17 1 14 | 10100 20 101 15 | 10101 21 101 16 | 11000 24 11 17 | 11001 25 11 18 | 11100 28 111 19 | 11101 29 111 20 | 100000 32 1 21 | 100001 33 1 22 | 101100 44 1101 23 | 101101 45 1101 24 | 110000 48 11 25 | 110001 49 11 26 | 111100 60 1111 27 | 111101 61 1111 28 | 1000000 64 1 29 | 1000001 65 1 30 | 1010000 80 101 31 | 1010001 81 101 32 | 1100000 96 11 33 | 1100001 97 11 34 | 1110000 112 111 35 | 1110001 113 111 36 | 10000000 128 1 37 | 10000001 129 1 38 | 10010000 144 1001 39 | 10010001 145 1001 40 | 11000000 192 11 41 | 11000001 193 11 42 | 11010000 208 1011 43 | 11010001 209 1011 44 | 100000000 256 1 45 | 100000001 257 1 46 | 101000000 320 101 47 | 101000001 321 101 48 | 110000000 384 11 49 | 110000001 385 11 50 | 111000000 448 111 51 | 111000001 449 111 52 | 1000000000 512 1 53 | 1000000001 513 1 54 | 1011000000 704 1101 55 | 1011000001 705 1101 56 | 1100000000 768 11 57 | 1100000001 769 11 58 | 1111000000 960 1111 59 | 1111000001 961 1111 60 | 10000000000 1024 1 61 | 10000000001 1025 1 62 | 10011000000 1216 11001 63 | 10011000001 1217 11001 64 | 10100000000 1280 101 65 | 10100000001 1281 101 66 | 10111000000 1472 11101 67 | 10111000001 1473 11101 68 | 11000000000 1536 11 69 | 11000000001 1537 11 70 | 11011000000 1728 11011 71 | 11011000001 1729 11011 72 | 11100000000 1792 111 73 | 11100000001 1793 111 74 | 11111000000 1984 11111 75 | 11111000001 1985 11111 76 | -------------------------------------------------------------------------------- /100851/in2: -------------------------------------------------------------------------------- 1 | 4 3 2 | 1 4 3 | 1 4 4 | 2 2 5 | -------------------------------------------------------------------------------- /100851/in3: -------------------------------------------------------------------------------- 1 | 5 8 2 | 1 2 3 | 2 3 4 | 2 4 5 | 3 1 6 | 3 4 7 | 4 5 8 | 5 1 9 | 5 3 10 | -------------------------------------------------------------------------------- /100851/in4: -------------------------------------------------------------------------------- 1 | 6 7 2 | 1 2 2 3 3 4 4 5 5 6 3 | 2 5 4 | 5 | -------------------------------------------------------------------------------- /100851/in5: -------------------------------------------------------------------------------- 1 | 6 7 2 | 1 2 2 3 3 4 4 5 5 6 6 1 3 | 2 5 4 | 5 | -------------------------------------------------------------------------------- /100851/my: -------------------------------------------------------------------------------- 1 | 2 2 | 1 3 | 2 4 | 1 5 | 1 6 | 1 7 | 1 8 | 2 9 | 2 10 | 3 11 | 1 12 | 1 13 | 1 14 | 1 15 | 2 16 | 1 17 | 0 18 | 3 19 | 2 20 | 1 21 | 1 22 | 2 23 | 2 24 | 0 25 | 2 26 | 3 27 | 1 28 | 1 29 | 2 30 | 1 31 | 2 32 | 2 33 | 2 34 | 0 35 | 3 36 | 1 37 | 0 38 | 0 39 | 1 40 | 1 41 | 0 42 | 1 43 | 1 44 | 0 45 | 2 46 | 2 47 | 1 48 | 2 49 | 1 50 | -------------------------------------------------------------------------------- /100851/out: -------------------------------------------------------------------------------- 1 | vert 2 | 0 1 4 5 3 | diag 4 | 0-4 5 | dist1 6 | i.F : 4 | i.S : 1 7 | i.F : 5 | i.S : 1 8 | i.F : 1 | i.S : 1 9 | i.F : 0 | i.S : 0 10 | 11 | dist2 12 | i.F : 0 | i.S : 1 13 | i.F : 5 | i.S : 1 14 | i.F : 1 | i.S : 1 15 | i.F : 4 | i.S : 0 16 | ---------- 17 | vert 18 | 1 2 3 4 19 | diag 20 | 1-3 21 | dist1 22 | i.F : 3 | i.S : 1 23 | i.F : 4 | i.S : 1 24 | i.F : 2 | i.S : 1 25 | i.F : 1 | i.S : 0 26 | 27 | dist2 28 | i.F : 1 | i.S : 1 29 | i.F : 4 | i.S : 1 30 | i.F : 2 | i.S : 1 31 | i.F : 3 | i.S : 0 32 | ---------- 33 | vert 34 | 0 1 2 3 4 5 35 | diag 36 | 0-4 1-3 1-4 37 | dist1 38 | i.F : 5 | i.S : 2 39 | i.F : 4 | i.S : 1 40 | i.F : 3 | i.S : 1 41 | i.F : 2 | i.S : 1 42 | i.F : 0 | i.S : 1 43 | i.F : 1 | i.S : 0 44 | 45 | dist2 46 | i.F : 2 | i.S : 2 47 | i.F : 1 | i.S : 1 48 | i.F : 0 | i.S : 1 49 | i.F : 5 | i.S : 1 50 | i.F : 3 | i.S : 1 51 | i.F : 4 | i.S : 0 52 | ---------- 53 | -------------------------------------------------------------------------------- /100860/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | //FILE *fin = freopen("in","r",stdin); 29 | //FILE *fout = freopen("out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | 38 | LL sum(LL n){ 39 | if(n<2)return n; 40 | LL no=(n+1)/2; 41 | LL ret=(no*(no+1))/2; 42 | ret += sum(n/2 -1); 43 | return ret; 44 | } 45 | 46 | int main() 47 | { 48 | int n; 49 | cin >> n; 50 | if(n==0){ 51 | cout << 0 << endl; 52 | return 0; 53 | } 54 | cout << sum(n-1) << endl; 55 | return 0; 56 | } 57 | 58 | -------------------------------------------------------------------------------- /100860/B.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | typedef pair PII; 28 | typedef vector VI; 29 | typedef vector< PII > VPII; 30 | 31 | const int b = 500; 32 | bitset<1000> A[b][1000]; 33 | bitset<1000> NL; 34 | 35 | int D[3]; 36 | void process(int t) 37 | { 38 | int B[3]; 39 | for(int i =0; i<3; i++) B[i] = D[i] % 1000; sort(B,B+3); 40 | if(t-b <= B[0] and B[0] < t) 41 | A[B[0] - t + b][B[1]].set(B[2]); 42 | } 43 | int main() 44 | { 45 | int N,a,bb,d0; 46 | cin>>N>>a>>bb>>d0; 47 | int t = 0; 48 | int ans = 0; 49 | while(1) 50 | { 51 | t+=b; 52 | D[0] = d0; 53 | D[1] =a * D[0] + bb; if(D[1]<0) D[1] += (1ll<<31); 54 | int pv = 1; 55 | int cr = 2; 56 | for(int i = 0; i=1000)break; 69 | } 70 | cout< 2 | using namespace std; 3 | 4 | typedef vector VI; 5 | 6 | 7 | 8 | #define TRACE 9 | #ifdef TRACE 10 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 11 | template 12 | void __f(const char* name, Arg1&& arg1){ 13 | cerr << name << " : " << arg1 << std::endl; 14 | } 15 | template 16 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 17 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 18 | } 19 | #else 20 | #define trace(...) 21 | #endif 22 | 23 | #define si(n) scanf("%d",&n) 24 | 25 | 26 | void f(int K, int n1, VI &A) 27 | { 28 | A.clear(); 29 | A.resize(K); 30 | if(n1==0)return; 31 | int r = K / n1; 32 | int g = K % n1; 33 | 34 | VI B; f(n1,g,B);reverse(B.begin(),B.end()); 35 | int i = 0; 36 | for(auto s : B) 37 | { 38 | A[i] = 1; 39 | i+=r; if(s)i++; 40 | } 41 | } 42 | 43 | 44 | int main() 45 | { 46 | int N,K; si(N); si(K); 47 | VI A; 48 | f(K,N%K,A); 49 | int cm = N/K; 50 | for(int i =0; i 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | //FILE *fin = freopen("in","r",stdin); 29 | //FILE *fout = freopen("out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | bool is_valid(int n) 38 | { 39 | while(n>0){ 40 | int l = n%4; 41 | if(l==2)return false; if(l==3)l = -1; 42 | n-=l; n/=4; 43 | } 44 | return true; 45 | } 46 | 47 | int f(int m) 48 | { 49 | if(m<2)return m; 50 | if(m<6)return m-1; 51 | int ret = 3 * f( (m-1) /4 ) + 1; 52 | while( m%4 != 1) 53 | { 54 | if(is_valid(m))ret++; m--; 55 | } 56 | return ret; 57 | } 58 | 59 | int main() 60 | { 61 | int n,m; 62 | cin>>n>>m; 63 | LL p = 1; 64 | LL sum = 0; 65 | while(sum0) 66 | { 67 | sum += p; 68 | p*=4; n--; 69 | } 70 | if(sum 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | //FILE *fin = freopen("in","r",stdin); 29 | //FILE *fout = freopen("out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | 38 | int main() 39 | { 40 | int N,B,W,Bnew,Wnew; 41 | cin>>N; 42 | N*=N; 43 | B=W=N/2; 44 | if(N&1) 45 | B++; 46 | int x1,y1,x2,y2; 47 | cin>>x1>>y1>>x2>>y2; 48 | int Nnew = (x2-x1+1)*(y2-y1+1); 49 | Bnew = Wnew = Nnew/2; 50 | if(Nnew&1) 51 | { 52 | if((x1+y1)&1) 53 | Wnew++; 54 | else 55 | Bnew++; 56 | } 57 | B-=Bnew; 58 | W-=Wnew; 59 | cout< 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | //FILE *fin = freopen("in","r",stdin); 29 | //FILE *fout = freopen("out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | 38 | int A[100][100][100]; 39 | int N,M; 40 | 41 | int R[100][100]; 42 | void mul(int C[][100], int A[][100], int B[][100]) 43 | { 44 | for(int i =0; i 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | //FILE *fin = freopen("in","r",stdin); 29 | //FILE *fout = freopen("out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | 38 | int main() 39 | { 40 | vector ar; 41 | ar.resize(2); 42 | cin >> ar[0] >> ar[1]; 43 | for(int i = 2; i<100000; i++){ 44 | ar.PB(ar[i-2]-ar[i-1]); 45 | if(ar.back()<0){ 46 | cout << i+1 << " " << ar.back() << endl; 47 | return 0; 48 | } 49 | } 50 | cout << "0 0\n"; 51 | return 0; 52 | } 53 | 54 | -------------------------------------------------------------------------------- /100863/D.cpp: -------------------------------------------------------------------------------- 1 | //karanaggarwal 2 | #include 3 | using namespace std; 4 | 5 | #define TRACE 6 | #ifdef TRACE 7 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 8 | template 9 | void __f(const char* name, Arg1&& arg1){ 10 | cerr << name << " : " << arg1 << std::endl; 11 | } 12 | template 13 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 14 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 15 | } 16 | #else 17 | #define trace(...) 18 | #endif 19 | 20 | #define si(x) scanf("%d",&x) 21 | #define F first 22 | #define S second 23 | #define PB push_back 24 | #define MP make_pair 25 | 26 | typedef long long LL; 27 | typedef pair PII; 28 | typedef vector VI; 29 | typedef vector VPII; 30 | 31 | const int mod = 1000000007; 32 | inline void add(int &x, int y){x+=y; if(x>=mod)x-=mod; if(x<0)x+=mod;} 33 | inline int mul(int x, int y){ return ((LL)x * y)%mod;} 34 | int gcd(int a, int b){ if(b)return gcd(b,a%b); return a;} 35 | int power(int a ,int p){int ret = 1; while(p){if(p&1)ret=mul(ret,a); a=mul(a,a); p/=2;}return ret;} 36 | 37 | set S; 38 | 39 | int main() 40 | { 41 | for(int i =0; i<=5000; i++){ 42 | trace(i); 43 | for(int j =0; j<=5000; j++) 44 | S.insert(i*i+ j*j); 45 | } 46 | trace(S.size()); 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /100863/F.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | //FILE *fin = freopen("in","r",stdin); 29 | //FILE *fout = freopen("out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | 38 | VI A; 39 | map C; 40 | int main() 41 | { 42 | int N,K; 43 | cin>>N>>K; 44 | A.resize(N); 45 | for(int i = 0; i0) 68 | { 69 | tm++; rem-=N; 70 | } 71 | cout< 3 | using namespace std; 4 | 5 | #define TRACE 6 | #ifdef TRACE 7 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 8 | template 9 | void __f(const char* name, Arg1&& arg1){ 10 | cerr << name << " : " << arg1 << std::endl; 11 | } 12 | template 13 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 14 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 15 | } 16 | #else 17 | #define trace(...) 18 | #endif 19 | 20 | #define si(x) scanf("%d",&x) 21 | #define F first 22 | #define S second 23 | #define PB push_back 24 | #define MP make_pair 25 | 26 | typedef long long LL; 27 | typedef pair PII; 28 | typedef vector VI; 29 | typedef vector VPII; 30 | 31 | 32 | 33 | bool SP[2000]; 34 | 35 | 36 | 37 | 38 | 39 | int main() 40 | { 41 | int N,K,S,D; 42 | cin>>N>>K>>S>>D; 43 | S--; D--; 44 | for(int i =0; i>S[i]; 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /100863/J.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | //FILE *fin = freopen("in","r",stdin); 29 | //FILE *fout = freopen("out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | 38 | int main() 39 | { 40 | map > m, mm; 41 | int n,tot=0; 42 | si(n); 43 | for(int i=0; i ar(3,0); 55 | for(auto &i: m){ 56 | for(int j=0; j<3; j++) 57 | ar[j] += i.S[j]; 58 | mm[i.F]=ar; 59 | } 60 | 61 | int maxvalue = INT_MIN, ansi, ansj, maxi=INT_MIN, ansmy; 62 | for(auto &i: mm){ 63 | int q = i.S[0]-i.S[1]; 64 | if(q > maxi) 65 | maxi = q, ansj=i.F; 66 | 67 | int p = tot + maxi + i.S[1]-i.S[2]; 68 | if(p > maxvalue){ 69 | maxvalue = p, ansi=i.F, ansmy=ansj; 70 | } 71 | } 72 | cout << ansmy << " " << ansi << endl; 73 | return 0; 74 | } 75 | 76 | -------------------------------------------------------------------------------- /100863/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100863/a.out -------------------------------------------------------------------------------- /100863/code.py: -------------------------------------------------------------------------------- 1 | def f(n): 2 | ret=1.0 3 | for i in range(n): 4 | ret = ret*(365.0-i)/365.0 5 | return 1-ret 6 | 7 | for i in range(366): 8 | print i, f(i) 9 | -------------------------------------------------------------------------------- /100863/in: -------------------------------------------------------------------------------- 1 | 11 2 | 973544 599588 3 | 75838 118922 4 | 39962 92185 5 | 383740 487317 6 | 34851 202158 7 | 318171 529624 8 | 26737 392984 9 | 17405 228895 10 | 52256 327466 11 | 115800 264818 12 | 215848 603117 13 | 43227 370427 14 | -------------------------------------------------------------------------------- /100863/in1: -------------------------------------------------------------------------------- 1 | 5 2 | 10 10 3 | 1 7 4 | 4 8 5 | 3 6 6 | 2 9 7 | 5 5 8 | -------------------------------------------------------------------------------- /100863/myD.cpp: -------------------------------------------------------------------------------- 1 | //karanaggarwal 2 | #include 3 | using namespace std; 4 | 5 | #define TRACE 6 | #ifdef TRACE 7 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 8 | template 9 | void __f(const char* name, Arg1&& arg1){ 10 | cerr << name << " : " << arg1 << std::endl; 11 | } 12 | template 13 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 14 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 15 | } 16 | #else 17 | #define trace(...) 18 | #endif 19 | 20 | #define si(x) scanf("%d",&x) 21 | #define F first 22 | #define S second 23 | #define PB push_back 24 | #define MP make_pair 25 | 26 | typedef long long LL; 27 | typedef pair PII; 28 | typedef vector VI; 29 | typedef vector VPII; 30 | 31 | const int mod = 1000000007; 32 | inline void add(int &x, int y){x+=y; if(x>=mod)x-=mod; if(x<0)x+=mod;} 33 | inline int mul(int x, int y){ return ((LL)x * y)%mod;} 34 | int gcd(int a, int b){ if(b)return gcd(b,a%b); return a;} 35 | int power(int a ,int p){int ret = 1; while(p){if(p&1)ret=mul(ret,a); a=mul(a,a); p/=2;}return ret;} 36 | 37 | set S; 38 | 39 | int main() 40 | { 41 | for(int i =0; i<=5000; i++){ 42 | trace(i); 43 | for(int j =0; j<=5000; j++) 44 | S.insert(i*i+ j*j); 45 | } 46 | trace(S.size()); 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /100863/out: -------------------------------------------------------------------------------- 1 | A.cpp: In function ‘int main()’: 2 | A.cpp:115:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] 3 | if(it == v.size() || tmp < v[it]) it--; 4 | ^ 5 | A.cpp:90:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] 6 | scanf("%d %d %d", &M, &N, &K); 7 | ^ 8 | A.cpp:91:42: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] 9 | scanf("%2d%*c%2d%*c%4d", &D, &MM, &Y); 10 | ^ 11 | -------------------------------------------------------------------------------- /100866/A.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | //FILE *fin = freopen("in","r",stdin); 29 | //FILE *fout = freopen("out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | string mult(string cur, long long int m) 38 | { 39 | reverse(cur.begin(), cur.end()); 40 | long long int carry = 0; 41 | for(auto& it : cur) 42 | { 43 | long long int t = it-'0'; 44 | t=t*m + carry; 45 | it = (t%10) + '0'; 46 | carry = t/10; 47 | } 48 | while(carry!=0) 49 | { 50 | cur+=(carry%10)+'0'; 51 | carry/=10; 52 | } 53 | reverse(cur.begin(), cur.end()); 54 | return cur; 55 | } 56 | 57 | int main() 58 | { 59 | string s; 60 | cin>>s; 61 | string cur="1"; 62 | for(int i=1; i<250; i++) 63 | { 64 | cur=mult(cur,i); 65 | if(cur==s) 66 | { 67 | cout< 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | //FILE *fin = freopen("in","r",stdin); 29 | //FILE *fout = freopen("out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | int N; 38 | long double C,dC; 39 | int dT; 40 | 41 | int f(int B1, int B2) 42 | { 43 | if(B1 < 0 or B1>N)return B2; 44 | long double x = (B1 - B2) * ( log(100) - log(dT) ); 45 | x += log(C + N*dC - B1 * dC) - log(C + N*dC - B2 * dC); 46 | if(x>0)return B1; 47 | return B2; 48 | } 49 | 50 | 51 | int main() 52 | { 53 | cin>>C>>N>>dC>>dT; dT = 100 - dT; 54 | long double B = 0; 55 | B = (C/dC + N); 56 | B -= (100) / (dT * (log(100) - log(dT))); 57 | int ansB = N; 58 | int cB = B; 59 | for(int cc = N; cc>=0 and N-cc<10000; cc--) 60 | ansB = f(cc,ansB); 61 | for(int d = 100000; d>=-100000; d--) 62 | ansB = f(cB+d,ansB); 63 | ansB = f(0,ansB); 64 | cout< 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | //FILE *fin = freopen("in","r",stdin); 29 | //FILE *fout = freopen("out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | 38 | int main() 39 | { 40 | int h,m,s; 41 | char ap; 42 | int a,b; 43 | scanf("%2d:%2d:%2d%c%*s",&h,&m,&s,&ap); 44 | if(h==12) h=0; 45 | a = h*60*60 + m*60 + s; 46 | if(ap=='P') 47 | a+=12*60*60; 48 | scanf("%2d:%2d:%2d%c%*s",&h,&m,&s,&ap); 49 | if(h==12) h=0; 50 | b = h*60*60 + m*60 + s; 51 | if(ap=='P') 52 | b+=12*60*60; 53 | int dif = b-a; 54 | if(dif<=0) dif+=24*60*60; 55 | s=dif%60; 56 | dif/=60; 57 | m=dif%60; 58 | dif/=60; 59 | h=dif; 60 | printf("%02d:%02d:%02d\n", h,m,s); 61 | return 0; 62 | } 63 | 64 | -------------------------------------------------------------------------------- /100866/E.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | //FILE *fin = freopen("in","r",stdin); 29 | //FILE *fout = freopen("out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | 38 | int main() 39 | { 40 | int N,M,K; 41 | scanf("%d %d %d", &N, &K, &M); 42 | vector x; 43 | for(int i=0; i 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | //FILE *fin = freopen("in","r",stdin); 29 | //FILE *fout = freopen("out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | bool check(long double num, long long int nm, long long int dm, long long int K) 38 | { 39 | long long int A = num*K; 40 | long long int B = (((long double)nm)/((long double)dm))*K; 41 | if(A==B) 42 | { 43 | cout<>S; 53 | int K = S.size()-2; 54 | long long int fact = 1; 55 | for(int i=0; i>num; 59 | for(long long int i=1; i<100000001; i++) 60 | { 61 | long long int nm = num*i; 62 | if(check(num,nm,i,fact)) break; 63 | if(check(num,nm+1,i,fact)) break; 64 | if(check(num,nm+2,i,fact)) break; 65 | } 66 | return 0; 67 | } 68 | 69 | -------------------------------------------------------------------------------- /100866/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkshadoww/Heuristics-CodeForces-GYM/3c9934ce109259261cc9d43834198b5b94b7cee7/100866/a.out -------------------------------------------------------------------------------- /100866/in: -------------------------------------------------------------------------------- 1 | 0.19999999 2 | -------------------------------------------------------------------------------- /100866/inj: -------------------------------------------------------------------------------- 1 | 10 3 3 2 | 1 3 100 3 | 000 4 | 000 5 | 001 6 | 010 7 | 100 8 | 100 9 | 100 10 | 100 11 | 110 12 | 111 13 | -------------------------------------------------------------------------------- /100866/inj (Case Conflict): -------------------------------------------------------------------------------- 1 | 10 3 2 2 | 1 3 100 3 | 000 4 | 000 5 | 001 6 | 010 7 | 100 8 | 100 9 | 100 10 | 100 11 | 110 12 | 111 13 | -------------------------------------------------------------------------------- /100866/newF.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #define TRACE 5 | #ifdef TRACE 6 | #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) 7 | template 8 | void __f(const char* name, Arg1&& arg1){ 9 | cerr << name << " : " << arg1 << std::endl; 10 | } 11 | template 12 | void __f(const char* names, Arg1&& arg1, Args&&... args){ 13 | const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); 14 | } 15 | #else 16 | #define trace(...) 17 | #endif 18 | 19 | #define PB push_back 20 | #define MP make_pair 21 | #define F first 22 | #define S second 23 | #define si(n) scanf("%d",&n) 24 | #define sll(n) scanf("%lld",&n) 25 | #define DRT() int t; cin>>t; while(t--) 26 | 27 | #ifdef ONLINE_JUDGE 28 | //FILE *fin = freopen("in","r",stdin); 29 | //FILE *fout = freopen("out","w",stdout); 30 | #endif 31 | 32 | typedef long long LL; 33 | typedef pair PII; 34 | typedef vector VI; 35 | typedef vector< PII > VPII; 36 | 37 | bool check(double num, int nm, int dm, int K) 38 | { 39 | int A = num*K; 40 | int B = (((double)nm)/((double)dm))*K; 41 | if(A==B) 42 | { 43 | cout<>S; 53 | int K = S.size()-2; 54 | int fact = 1; 55 | for(int i=0; i>num; 59 | for(int i=1; i<100000001; i++) 60 | { 61 | int nm = num*i; 62 | if(check(num,nm,i,fact)) break; 63 | if(check(num,nm+1,i,fact)) break; 64 | if(check(num,nm-1,i,fact)) break; 65 | if(check(num,nm+2,i,fact)) break; 66 | } 67 | return 0; 68 | } 69 | 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Heuristics-CodeForces-GYM 2 | Practice folders for contests done by team 'Heuristics' in ACM ICPC season 2015-16 3 | --------------------------------------------------------------------------------