Overview
SHA1 Hash: | d82ca3d4deb1a559d5ce49c8a0829f783f374510 |
---|---|
Date: | 2014-05-29 00:57:27 |
User: | kinaba |
Comment: | 621 |
Timelines: | family | ancestors | descendants | both | trunk |
Downloads: | Tarball | ZIP archive |
Other Links: | files | file ages | manifest |
Tags And Properties
- branch=trunk inherited from [9165bd3629]
- sym-trunk inherited from [9165bd3629]
Changes
Added SRM/621-U/1A.cpp version [3ccaf00d30fae699]
1 +#include <iostream> 2 +#include <sstream> 3 +#include <iomanip> 4 +#include <vector> 5 +#include <string> 6 +#include <map> 7 +#include <set> 8 +#include <algorithm> 9 +#include <numeric> 10 +#include <iterator> 11 +#include <functional> 12 +#include <complex> 13 +#include <queue> 14 +#include <stack> 15 +#include <cmath> 16 +#include <cassert> 17 +#include <tuple> 18 +using namespace std; 19 +typedef long long LL; 20 +typedef complex<double> CMP; 21 + 22 +class RadioRange { public: 23 + double RadiusProbability(vector <int> X, vector <int> Y, vector <int> R, int Z) 24 + { 25 + vector<pair<double, bool>> ev; 26 + 27 + const int N = X.size(); 28 + for(int i=0; i<N; ++i) 29 + { 30 + double x = X[i]; 31 + double y = Y[i]; 32 + double r = R[i]; 33 + double d = sqrt(x*x+y*y); 34 + // (s,e) is bad 35 + double s = max(0.0, d-r); 36 + double e = min(double(Z), d+r); 37 + ev.emplace_back(s, true); 38 + ev.emplace_back(e, false); 39 + } 40 + 41 + double total_bad = 0.0; 42 + 43 + sort(ev.begin(), ev.end()); 44 + int nest = 0; 45 + double prev_beg; 46 + for(auto ei: ev) { 47 + double x = ei.first; 48 + bool beg = ei.second; 49 + if(beg) { 50 + if(++nest == 1) 51 + prev_beg = x; 52 + } 53 + else { 54 + if(--nest == 0) 55 + total_bad += (x-prev_beg); 56 + } 57 + } 58 + 59 + return (Z - total_bad) / Z; 60 + } 61 +}; 62 + 63 +// BEGIN CUT HERE 64 +#include <ctime> 65 +double start_time; string timer() 66 + { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); } 67 +template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) 68 + { os << "{ "; 69 + for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it) 70 + os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; } 71 +void verify_case(const double& Expected, const double& Received) { 72 + bool ok = (abs(Expected - Received) < 1e-9); 73 + if(ok) cerr << "PASSED" << timer() << endl; else { cerr << "FAILED" << timer() << endl; 74 + cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } } 75 +#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock(); 76 +#define END verify_case(_, RadioRange().RadiusProbability(X, Y, R, Z));} 77 +int main(){ 78 + 79 +CASE(0) 80 + int X_[] = {0}; 81 + vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 82 + int Y_[] = {0}; 83 + vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 84 + int R_[] = {5}; 85 + vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 86 + int Z = 10; 87 + double _ = 0.5; 88 +END 89 +CASE(1) 90 + int X_[] = {0}; 91 + vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 92 + int Y_[] = {0}; 93 + vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 94 + int R_[] = {10}; 95 + vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 96 + int Z = 10; 97 + double _ = 0.0; 98 +END 99 +CASE(2) 100 + int X_[] = {10}; 101 + vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 102 + int Y_[] = {10}; 103 + vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 104 + int R_[] = {10}; 105 + vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 106 + int Z = 10; 107 + double _ = 0.4142135623730951; 108 +END 109 +CASE(3) 110 + int X_[] = {11, -11, 0, 0}; 111 + vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 112 + int Y_[] = {0, 0, 11, -11}; 113 + vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 114 + int R_[] = {10, 10, 10, 10}; 115 + vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 116 + int Z = 31; 117 + double _ = 0.3548387096774194; 118 +END 119 +CASE(4) 120 + int X_[] = {100}; 121 + vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 122 + int Y_[] = {100}; 123 + vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 124 + int R_[] = {1}; 125 + vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 126 + int Z = 10; 127 + double _ = 1.0; 128 +END 129 +CASE(5) 130 + int X_[] = {1000000000}; 131 + vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 132 + int Y_[] = {1000000000}; 133 + vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 134 + int R_[] = {1000000000}; 135 + vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 136 + int Z = 1000000000; 137 + double _ = 0.41421356237309503; 138 +END 139 +CASE(6) 140 + int X_[] = {20, -20, 0, 0}; 141 + vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 142 + int Y_[] = {0, 0, 20, -20}; 143 + vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 144 + int R_[] = {50, 50, 50, 50}; 145 + vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 146 + int Z = 100; 147 + double _ = 0.3; 148 +END 149 +CASE(7) 150 + int X_[] = {0, -60, -62, -60, 63, -97}; 151 + vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 152 + int Y_[] = {-72, 67, 61, -8, -32, 89}; 153 + vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 154 + int R_[] = {6, 7, 8, 7, 5, 6}; 155 + vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 156 + int Z = 918; 157 + double _ = 0.9407071068962471; 158 +END 159 +/* 160 +CASE(8) 161 + int X_[] = ; 162 + vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 163 + int Y_[] = ; 164 + vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 165 + int R_[] = ; 166 + vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 167 + int Z = ; 168 + double _ = ; 169 +END 170 +CASE(9) 171 + int X_[] = ; 172 + vector <int> X(X_, X_+sizeof(X_)/sizeof(*X_)); 173 + int Y_[] = ; 174 + vector <int> Y(Y_, Y_+sizeof(Y_)/sizeof(*Y_)); 175 + int R_[] = ; 176 + vector <int> R(R_, R_+sizeof(R_)/sizeof(*R_)); 177 + int Z = ; 178 + double _ = ; 179 +END 180 +*/ 181 +} 182 +// END CUT HERE
Added SRM/621-U/1B-U.cpp version [a3df8a305cced3e3]
1 +#include <iostream> 2 +#include <sstream> 3 +#include <iomanip> 4 +#include <vector> 5 +#include <string> 6 +#include <map> 7 +#include <set> 8 +#include <algorithm> 9 +#include <numeric> 10 +#include <iterator> 11 +#include <functional> 12 +#include <complex> 13 +#include <queue> 14 +#include <stack> 15 +#include <cmath> 16 +#include <cassert> 17 +#include <tuple> 18 +using namespace std; 19 +typedef long long LL; 20 +typedef complex<double> CMP; 21 + 22 +class TreesAnalysis { public: 23 + typedef int EID; 24 + int N; 25 + long long treeSimilarity(vector <int> tree1, vector <int> tree2) 26 + { 27 + N = tree1.size() + 1; 28 + vector<vector<pair<EID,int>>> T1(N); 29 + vector<vector<int>> T2(N); 30 + for(int v=0; v<N-1; ++v) { 31 + int u = tree1[v]; 32 + T1[v].emplace_back(v, u); 33 + T1[u].emplace_back(v+N, v); 34 + } 35 + for(int v=0; v<N-1; ++v) { 36 + int u = tree2[v]; 37 + T2[v].push_back(u); 38 + T2[u].push_back(v); 39 + } 40 + 41 + LL total = 0; 42 + for(int v2=0; v2<N-1; ++v2) { 43 + int u2 = tree2[v2]; 44 + 45 + function<void(int,int)> rec; 46 + vector<bool> sub_vu(N), sub_uv(N, true); 47 + rec = [&](int a, int b) { 48 + sub_vu[b] = true; 49 + sub_uv[b] = false; 50 + for(int c: T2[b]) if(c!=a) 51 + rec(b,c); 52 + }; 53 + rec(v2, u2); 54 + 55 + vector<int> memo_vu(2*N, -1), memo_uv(2*N, -1); 56 + for(int v1=0; v1<N-1; ++v1) { 57 + int u1 = tree1[v1]; 58 + int s1 = sim(T1, v1, v1, u1, sub_vu, memo_vu); 59 + int s2 = sim(T1, v1, v1, u1, sub_uv, memo_uv); 60 + int s3 = sim(T1, v1+N, u1, v1, sub_vu, memo_vu); 61 + int s = max(max(s1, s2), max(s3, N-s1-s2-s3)); 62 + total += s*s; 63 + } 64 + } 65 + return total; 66 + } 67 + 68 + int sim(const vector<vector<pair<EID,int>>>& T1, int E, int a1, int b1, vector<bool>& sub, vector<int>& memo) 69 + { 70 + if(memo[E]>=0) 71 + return memo[E]; 72 + 73 + int total = sub[b1]; 74 + for(pair<EID,int> ic: T1[b1]) {EID id=ic.first; int c1=ic.second; if(c1 != a1) { 75 + total += sim(T1, id, b1, c1, sub, memo); 76 + }} 77 + return memo[E] = total; 78 + } 79 +}; 80 + 81 +// BEGIN CUT HERE 82 +#include <ctime> 83 +double start_time; string timer() 84 + { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); } 85 +template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) 86 + { os << "{ "; 87 + for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it) 88 + os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; } 89 +void verify_case(const long long& Expected, const long long& Received) { 90 + bool ok = (Expected == Received); 91 + if(ok) cerr << "PASSED" << timer() << endl; else { cerr << "FAILED" << timer() << endl; 92 + cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } } 93 +#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock(); 94 +#define END verify_case(_, TreesAnalysis().treeSimilarity(tree1, tree2));} 95 +int main(){ 96 + 97 +CASE(0) 98 + int tree1_[] = {1}; 99 + vector <int> tree1(tree1_, tree1_+sizeof(tree1_)/sizeof(*tree1_)); 100 + int tree2_[] = {1}; 101 + vector <int> tree2(tree2_, tree2_+sizeof(tree2_)/sizeof(*tree2_)); 102 + long long _ = 1LL; 103 +END 104 +CASE(1) 105 + int tree1_[] = {2, 4, 1, 0}; 106 + vector <int> tree1(tree1_, tree1_+sizeof(tree1_)/sizeof(*tree1_)); 107 + int tree2_[] = {1, 4, 4, 4}; 108 + vector <int> tree2(tree2_, tree2_+sizeof(tree2_)/sizeof(*tree2_)); 109 + long long _ = 111LL; 110 +END 111 +CASE(2) 112 + int tree1_[] = {1, 2, 3, 4}; 113 + vector <int> tree1(tree1_, tree1_+sizeof(tree1_)/sizeof(*tree1_)); 114 + int tree2_[] = {1, 2, 3, 4} 115 +; 116 + vector <int> tree2(tree2_, tree2_+sizeof(tree2_)/sizeof(*tree2_)); 117 + long long _ = 128LL; 118 +END 119 +CASE(3) 120 + int tree1_[] = {2, 3, 4, 4, 5, 8, 5, 6, 10, 8}; 121 + vector <int> tree1(tree1_, tree1_+sizeof(tree1_)/sizeof(*tree1_)); 122 + int tree2_[] = {9, 0, 1, 0, 3, 0, 5, 0, 7, 10}; 123 + vector <int> tree2(tree2_, tree2_+sizeof(tree2_)/sizeof(*tree2_)); 124 + long long _ = 6306LL; 125 +END 126 +CASE(4) 127 + int tree1_[] = {222, 261, 167, 133, 174, 150, 165, 311, 208, 268, 111, 222, 154, 277, 282, 201, 46, 124, 194, 331, 4, 216, 111, 128 +275, 72, 322, 137, 216, 241, 48, 72, 101, 232, 165, 151, 263, 139, 16, 122, 140, 84, 135, 314, 106, 309, 126, 102, 129 +151, 208, 27, 242, 93, 83, 314, 136, 77, 82, 215, 16, 232, 286, 156, 294, 38, 67, 204, 206, 137, 174, 282, 188, 130 +143, 84, 279, 236, 136, 158, 10, 65, 332, 122, 44, 329, 62, 174, 67, 102, 216, 245, 296, 287, 307, 93, 197, 169, 131 +268, 266, 294, 157, 277, 95, 68, 214, 135, 211, 127, 82, 108, 212, 161, 243, 212, 207, 119, 119, 158, 97, 290, 21, 132 +217, 230, 85, 171, 13, 138, 294, 304, 204, 318, 115, 70, 210, 195, 223, 37, 164, 149, 3, 164, 328, 316, 108, 330, 133 +48, 38, 324, 222, 193, 50, 41, 184, 93, 148, 41, 151, 139, 106, 301, 264, 80, 249, 110, 244, 109, 212, 223, 279, 134 +330, 67, 27, 301, 165, 236, 194, 3, 157, 1, 217, 311, 87, 105, 4, 286, 37, 6, 31, 111, 66, 230, 227, 244, 322, 135 +196, 65, 69, 305, 112, 133, 231, 68, 153, 206, 309, 248, 329, 58, 69, 69, 328, 0, 29, 233, 243, 305, 167, 80, 65, 136 +194, 190, 179, 142, 196, 324, 206, 134, 50, 272, 261, 10, 147, 329, 322, 14, 142, 169, 21, 296, 284, 241, 55, 304, 137 +150, 166, 230, 167, 304, 87, 156, 156, 97, 274, 324, 196, 101, 82, 106, 260, 242, 233, 207, 305, 10, 166, 53, 18, 138 +154, 233, 217, 296, 263, 168, 138, 30, 115, 135, 188, 98, 309, 292, 204, 150, 210, 332, 330, 166, 96, 70, 24, 229, 139 +215, 201, 285, 40, 287, 142, 68, 133, 208, 268, 161, 310, 41, 203, 73, 275, 184, 163, 227, 89, 110, 328, 108, 112, 140 +125, 164, 127, 179, 267, 221, 49, 139, 1, 84, 136, 38, 6, 70, 246, 243, 3, 188, 297}; 141 + vector <int> tree1(tree1_, tree1_+sizeof(tree1_)/sizeof(*tree1_)); 142 + int tree2_[] = {174, 262, 195, 288, 157, 278, 36, 133, 230, 273, 222, 138, 97, 23, 189, 141, 296, 55, 45, 301, 81, 199, 188, 289, 143 +187, 164, 113, 58, 138, 300, 289, 282, 329, 91, 130, 178, 92, 143, 48, 81, 311, 133, 151, 286, 171, 196, 199, 80, 144 +83, 121, 65, 151, 277, 136, 49, 111, 58, 36, 259, 14, 31, 9, 136, 181, 122, 324, 249, 114, 9, 37, 259, 242, 165, 145 +174, 34, 36, 298, 92, 301, 237, 178, 82, 65, 295, 110, 311, 274, 235, 68, 56, 259, 180, 195, 52, 110, 68, 140, 71, 146 +52, 296, 290, 115, 213, 82, 209, 209, 74, 178, 302, 131, 99, 205, 296, 309, 288, 180, 329, 71, 143, 58, 152, 273, 147 +196, 7, 169, 88, 231, 331, 213, 181, 80, 249, 170, 246, 16, 127, 75, 276, 332, 174, 21, 180, 163, 78, 242, 312, 148 +295, 199, 89, 142, 85, 195, 115, 119, 95, 94, 279, 290, 3, 33, 93, 284, 20, 47, 47, 78, 331, 271, 113, 179, 249, 149 +331, 92, 324, 9, 71, 232, 46, 28, 289, 80, 28, 80, 134, 20, 280, 277, 48, 205, 107, 52, 320, 4, 191, 160, 182, 150 +189, 227, 295, 115, 54, 195, 78, 292, 189, 273, 301, 69, 305, 36, 222, 167, 326, 106, 48, 45, 74, 61, 181, 311, 151 +292, 270, 201, 34, 314, 218, 214, 92, 269, 18, 37, 151, 142, 209, 11, 227, 327, 198, 28, 272, 152, 22, 47, 143, 152 +332, 253, 273, 35, 78, 130, 295, 223, 181, 329, 18, 238, 300, 186, 274, 99, 300, 322, 41, 185, 311, 288, 198, 2, 153 +37, 83, 238, 133, 122, 178, 107, 106, 66, 238, 69, 90, 38, 109, 246, 278, 288, 250, 321, 269, 130, 28, 115, 122, 154 +33, 185, 275, 99, 130, 99, 152, 268, 133, 249, 180, 30, 210, 201, 324, 29, 290, 143, 3, 269, 68, 106, 230, 1, 155 +269, 29, 120, 259, 324, 328, 23, 243, 9, 61, 14, 118, 199, 146, 237, 14}; 156 + vector <int> tree2(tree2_, tree2_+sizeof(tree2_)/sizeof(*tree2_)); 157 + long long _ = 11478648052LL; 158 +END 159 +/* 160 +CASE(5) 161 + int tree1_[] = ; 162 + vector <int> tree1(tree1_, tree1_+sizeof(tree1_)/sizeof(*tree1_)); 163 + int tree2_[] = ; 164 + vector <int> tree2(tree2_, tree2_+sizeof(tree2_)/sizeof(*tree2_)); 165 + long long _ = LL; 166 +END 167 +CASE(6) 168 + int tree1_[] = ; 169 + vector <int> tree1(tree1_, tree1_+sizeof(tree1_)/sizeof(*tree1_)); 170 + int tree2_[] = ; 171 + vector <int> tree2(tree2_, tree2_+sizeof(tree2_)/sizeof(*tree2_)); 172 + long long _ = LL; 173 +END 174 +*/ 175 +} 176 +// END CUT HERE
Added SRM/621-U/1C-U.cpp version [8d41104c0e490245]
1 +#include <iostream> 2 +#include <sstream> 3 +#include <iomanip> 4 +#include <vector> 5 +#include <string> 6 +#include <map> 7 +#include <set> 8 +#include <algorithm> 9 +#include <numeric> 10 +#include <iterator> 11 +#include <functional> 12 +#include <complex> 13 +#include <queue> 14 +#include <stack> 15 +#include <cmath> 16 +#include <cassert> 17 +#include <tuple> 18 +using namespace std; 19 +typedef long long LL; 20 +typedef complex<double> CMP; 21 + 22 +struct SaComp { 23 + const int sp, *sr, srlen; 24 + SaComp(int sp, const vector<int>& sr) : sp(sp), sr(&sr[0]), srlen(sr.size()) {} 25 + bool operator()(int a, int b) const 26 + { return make_pair(sr[a], a+sp<srlen?sr[a+sp]:0x7fffffff) 27 + < make_pair(sr[b], b+sp<srlen?sr[b+sp]:0x7fffffff); } 28 +}; 29 + 30 +template<typename RanIt> 31 +vector<int> compute_suffix_array(RanIt beg, RanIt end) 32 +{ 33 + const int N = end - beg; 34 + 35 + vector<int> sa(N); 36 + vector<int> sort_rank(beg, end); 37 + for(int i=0; i<N; ++i) 38 + sa[i] = i; 39 + 40 + sort(sa.begin(), sa.end(), SaComp(0, sort_rank)); 41 + for(int sorted_prefix=1; sorted_prefix<N; sorted_prefix*=2) 42 + { 43 + SaComp cmp(sorted_prefix, sort_rank); 44 + sort(sa.begin(), sa.end(), cmp); 45 + 46 + vector<int> block_id(N); 47 + for(int i=1; i<N; ++i) 48 + block_id[i] = block_id[i-1] + (cmp(sa[i-1], sa[i]) ? 1 : 0); 49 + for(int i=0; i<N; ++i) 50 + sort_rank[sa[i]] = block_id[i]; 51 + } 52 + return sa; 53 +} 54 + 55 +vector<int> inv_sa(const vector<int>& sa) 56 +{ 57 + vector<int> isa(sa.size()); 58 + for(int i=0; i<sa.size(); ++i) 59 + isa[sa[i]] = i; 60 + return isa; 61 +} 62 + 63 +template<typename RanIte> 64 +vector<int> longest_common_prefix(RanIte beg, RanIte end, const vector<int>& sa) 65 +{ 66 + const int N = sa.size(); 67 + vector<int> lcp(N); 68 + vector<int> inv = inv_sa(sa); 69 + 70 + int len = 0; 71 + for(int i=0; i<N; ++i) { 72 + int sa_idx = inv[i]; 73 + if( sa_idx == 0 ) 74 + lcp[sa_idx] = -1; 75 + else { 76 + for(int k=sa[sa_idx-1]; i+len<N && k+len<N && *(beg+i+len)==*(beg+k+len);) 77 + ++len; 78 + lcp[sa_idx] = len; 79 + } 80 + if(len) --len; 81 + } 82 + return lcp; 83 +} 84 + 85 +class StringsNightmareAgain { public: 86 + long long UniqueSubstrings(int a, int b, int c, int d, int n) 87 + { 88 + string S(n,'a'); 89 + for(int i=0; i<a; ++i) { 90 + b = int((LL(b)*c+d)%n); 91 + S[b] = 'b'; 92 + } 93 + return solve(S); 94 + } 95 + 96 + LL solve(const string& S) 97 + { 98 + vector<int> sa = compute_suffix_array(S.begin(), S.end()); 99 + vector<int> lcp = longest_common_prefix(S.begin(), S.end(), sa); 100 + 101 + for(int i=0; i+1<sa.size(); ++i) 102 + { 103 + 104 + } 105 + return 0; 106 + } 107 +}; 108 + 109 +// BEGIN CUT HERE 110 +#include <ctime> 111 +double start_time; string timer() 112 + { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); } 113 +template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) 114 + { os << "{ "; 115 + for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it) 116 + os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; } 117 +void verify_case(const long long& Expected, const long long& Received) { 118 + bool ok = (Expected == Received); 119 + if(ok) cerr << "PASSED" << timer() << endl; else { cerr << "FAILED" << timer() << endl; 120 + cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } } 121 +#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock(); 122 +#define END verify_case(_, StringsNightmareAgain().UniqueSubstrings(a, b, c, d, n));} 123 +int main(){ 124 + 125 +CASE(0) 126 + int a = 0; 127 + int b = 0; 128 + int c = 0; 129 + int d = 0; 130 + int n = 4; 131 + long long _ = 2LL; 132 +END 133 +CASE(1) 134 + int a = 2; 135 + int b = 3; 136 + int c = 1; 137 + int d = 1; 138 + int n = 6; 139 + long long _ = 3LL; 140 +END 141 +CASE(2) 142 + int a = 4; 143 + int b = 3; 144 + int c = 1; 145 + int d = 1; 146 + int n = 6; 147 + long long _ = 3LL; 148 +END 149 +CASE(3) 150 + int a = 4; 151 + int b = 3; 152 + int c = 3; 153 + int d = 3; 154 + int n = 10; 155 + long long _ = 5LL; 156 +END 157 +CASE(4) 158 + int a = 5; 159 + int b = 3; 160 + int c = 2; 161 + int d = 3; 162 + int n = 11; 163 + long long _ = 9LL; 164 +END 165 +CASE(5) 166 + int a = 10; 167 + int b = 1000000; 168 + int c = 1000000; 169 + int d = 1; 170 + int n = 51; 171 + long long _ = 63LL; 172 +END 173 +/* 174 +CASE(6) 175 + int a = ; 176 + int b = ; 177 + int c = ; 178 + int d = ; 179 + int n = ; 180 + long long _ = LL; 181 +END 182 +CASE(7) 183 + int a = ; 184 + int b = ; 185 + int c = ; 186 + int d = ; 187 + int n = ; 188 + long long _ = LL; 189 +END 190 +*/ 191 +} 192 +// END CUT HERE