indestinee.com
Graph – Indestinee
http://www.indestinee.com/category/acm/graph
To my free life. URAL 2064 Caterpillars (dijkstra heap). AC for( int i = M ; i ; i - ) if( vis[i] ) for( int j = i ; ; j = i 1 ){ if( j = M ){ int tmp = i - ( j - M ); if( ans[M] tmp ){ q.push( node ( M , ans[M] = tmp ) ); } break; } if(! Ans[j] ) q.push( node( j , ans[j] = i ) ); } / WA for( int i = M ; i ; i - ) if( vis[i] ) for( int j = i ; j = M ; j = i 1 ) if(! Ans[j] ) q.push( node( j , ans[j] = i ) );. Ans[j] ) q.push( node( j , ans[j] = i ) ); } while(! Freopen( "data.in" , "r" , stdin );.
indestinee.com
Number Theory – Indestinee
http://www.indestinee.com/category/acm/number-theory
To my free life. HDU 5514 Frogs 数论 容斥原理 dp. N个数,每次步长为1,那么x步点值是a*x % m,就是a * x - k * m,那么也就是 gcd( a , m ) (a * x - k * m),. 也就是说等价于 每次步长gcd( a, m ). 到最后如果当前lcm为k,也就是步长为k,的和,就是0 k 2k . m - k. Date: * 2015/11/05 * Author: * OpenPandora */ #include map #include set #include cmath #include queue #include cstdio #include string #include vector #include cstring #include iostream #include algorithm using namespace std; string in = "data"; string out = "data"; int gcd( int x , int y ){ return y? Case #%d: %I64d n".
indestinee.com
Bruce Force – Indestinee
http://www.indestinee.com/category/acm/bruce-force
To my free life. URAL 2043 Kirill the Gardener 2 (综合题). Fun1(n, m) : fun2(n, m) ; #endif } return 0; }. Include bits/stdc .h. Define LOCAL DEBUG SHOW. Ifdef LOCAL DEBUG SHOW. Ifdef LOCAL DEBUG SHOW. Case %I64d: st = %I64d n". Ifdef LOCAL DEBUG SHOW. T = %I64d, a1 = %I64d, a2 = %I64d n". Ifdef LOCAL DEBUG SHOW. T = %I64d, a1 = %I64d, a2 = %I64d n". Ifdef LOCAL DEBUG SHOW. Ifdef LOCAL DEBUG SHOW. Ifdef LOCAL DEBUG SHOW. I = %I64d: st = %I64d n". Ifdef LOCAL DEBUG SHOW. T = %I64d, a1 = %I64d, a2 = %I64d n".
indestinee.com
Combination Math – Indestinee
http://www.indestinee.com/category/acm/combination-math
To my free life. Aizu 2556 Integer in Integer(基本计数). 1LL : ( pre mod - ( b[0] = '0' & m = 1 ) ) 1 ) * ten[n-i-m] % mod ) % mod; else if( flag 0 ) ans = ( ans ( i = 0? 0LL : ( pre mod - ( b[0] = '0' & m = 1 ) ) ) % mod * ten[n-i-m] % mod ) % mod; else{ ans = ( ans ( i = 0? C[j] ){ flag = 0; break; } } add = flag; } printf( "%lld n" , ( solve( b , m , c , l ) - solve( a , n , c , l ) mod add ) % mod ); return 0; }. 于Aizu 2556 Integer in Integer(基本计数).
indestinee.com
Others – Indestinee
http://www.indestinee.com/category/acm/others
To my free life.
indestinee.com
NULL – Indestinee
http://www.indestinee.com/category/null
To my free life. 哈密顿距离 = 2),和 白棋的必胜点. Mpend() { int bef = mp[before]; if (bef c) { dp[i][d] = dp[bef][d] 2; } else { dp[i][d] = 2; } } else { if (check(before) { dp[i][d] = 3; } else { dp[i][d] = 2; } } before = white[i] dir[d]; if (mp.find(before)! Mpend() { int bef = mp[before]; if (bef c) { dp[i][d] = dp[bef][d] 2; } else { dp[i][d] = 2; } } else { if (check(before) { dp[i][d] = 3; } else { dp[i][d] = 2; } } before = white[i] dir[d]; if (mp.find(before)! Check(a) return false; if (mp.find(a)! 1) numr ...
indestinee.com
Simple Problem – Indestinee
http://www.indestinee.com/category/acm/simple-problem
To my free life. Gym 100942J Liquid (模拟 Set). Node( x , 1 ) 表示这个线段起始在x. Node( x , 2 ) 表示这个线段终止在x. Author: * indestinee * Date: * 2016/04/03 */ #include map #include set #include cmath #include cstdio #include string #include vector #include cstring #include iostream #include algorithm using namespace std; / I just wanna know what does 'greater than' mean! Send() ; itx ){ printf( "%c%I64d%s" , (*itx).y = 1? Itx)x , (*itx).y = 2? I just wanna know what does 'greater than' mean! Define mp make pair.
indestinee.com
Data Structure – Indestinee
http://www.indestinee.com/category/acm/data-structure
To my free life. Gym 100942J Liquid (模拟 Set). Node( x , 1 ) 表示这个线段起始在x. Node( x , 2 ) 表示这个线段终止在x. Author: * indestinee * Date: * 2016/04/03 */ #include map #include set #include cmath #include cstdio #include string #include vector #include cstring #include iostream #include algorithm using namespace std; / I just wanna know what does 'greater than' mean! Send() ; itx ){ printf( "%c%I64d%s" , (*itx).y = 1? Itx)x , (*itx).y = 2? I just wanna know what does 'greater than' mean! Define mp make pair.
indestinee.com
LeetCode – Indestinee
http://www.indestinee.com/category/acm/leetcode
To my free life. LeetCode 84. Largest Rectangle in Histogram (单调栈查找i左侧最近小于v[i]的数). Class Solution { public: int largestRectangleArea(vector int and heights) { int n = heights.size(), s[n], cnt[n], top = -1; for( int i = 0 ; i n ; i ){ while( top! 1 & heights[s[top] = heights[i] ) top - ; cnt[i] = i - ( top = -1? 1 : s[top] ); s[ top] = i; } top = -1; int S = 0; for( int i = n - 1 ; i 1 ; i - ){ while( top! 1 & heights[s[top] = heights[i] ) top - ; S = max( S , ( ( top = -1?
indestinee.com
Math – Indestinee
http://www.indestinee.com/category/acm/math
To my free life. HihoCoder 1422 Harmonic Matrix Counter (Guass & bitset). 我们用一个bitset maxn a[i][j] 表示第i行第j列是否包含元素. 那么a[i 1][j] = a[i][j] a[i-1][j] a[i][j-1] a[i][j 1]. 所以最后第n - 1行 最后一行 的条件没有使用。 故a[n - 1][k] = 0. Bd[0]) return a.d[0] b.d[0]; for (int i = a.d[0]; i; i- ) if (a.d[i]! Include bits/stdc .h. 于HihoCoder 1422 Harmonic Matrix Counter (Guass & bitset).