2ba3bf09a0 2013-05-11 kinaba: #include <iostream> 2ba3bf09a0 2013-05-11 kinaba: #include <sstream> 2ba3bf09a0 2013-05-11 kinaba: #include <iomanip> 2ba3bf09a0 2013-05-11 kinaba: #include <vector> 2ba3bf09a0 2013-05-11 kinaba: #include <string> 2ba3bf09a0 2013-05-11 kinaba: #include <map> 2ba3bf09a0 2013-05-11 kinaba: #include <set> 2ba3bf09a0 2013-05-11 kinaba: #include <algorithm> 2ba3bf09a0 2013-05-11 kinaba: #include <numeric> 2ba3bf09a0 2013-05-11 kinaba: #include <iterator> 2ba3bf09a0 2013-05-11 kinaba: #include <functional> 2ba3bf09a0 2013-05-11 kinaba: #include <complex> 2ba3bf09a0 2013-05-11 kinaba: #include <queue> 2ba3bf09a0 2013-05-11 kinaba: #include <stack> 2ba3bf09a0 2013-05-11 kinaba: #include <cmath> 2ba3bf09a0 2013-05-11 kinaba: #include <cassert> 2ba3bf09a0 2013-05-11 kinaba: using namespace std; 2ba3bf09a0 2013-05-11 kinaba: typedef long long LL; 2ba3bf09a0 2013-05-11 kinaba: typedef long double LD; 2ba3bf09a0 2013-05-11 kinaba: typedef complex<LD> CMP; 2ba3bf09a0 2013-05-11 kinaba: 2ba3bf09a0 2013-05-11 kinaba: class TheMountain { public: 2ba3bf09a0 2013-05-11 kinaba: int minSum(int H, int W, vector <int> Y, vector <int> X, vector <int> V) 2ba3bf09a0 2013-05-11 kinaba: { 2ba3bf09a0 2013-05-11 kinaba: const int N = Y.size(); 2ba3bf09a0 2013-05-11 kinaba: static const int INF = 0x3fffffff; 2ba3bf09a0 2013-05-11 kinaba: int best = INF; 2ba3bf09a0 2013-05-11 kinaba: 2ba3bf09a0 2013-05-11 kinaba: vector< vector<int> > fixed(H, vector<int>(W, 0)); 2ba3bf09a0 2013-05-11 kinaba: for(int i=0; i<N; ++i) 2ba3bf09a0 2013-05-11 kinaba: fixed[Y[i]][X[i]] = V[i]; 2ba3bf09a0 2013-05-11 kinaba: 2ba3bf09a0 2013-05-11 kinaba: for(int x=0; x<W; ++x) 2ba3bf09a0 2013-05-11 kinaba: { 2ba3bf09a0 2013-05-11 kinaba: vector< vector<int> > td(H, vector<int>(W)); 2ba3bf09a0 2013-05-11 kinaba: vector<int> td_sum(H); 2ba3bf09a0 2013-05-11 kinaba: int td_end = 0; 2ba3bf09a0 2013-05-11 kinaba: for(int y=0; y<H; ++y) 2ba3bf09a0 2013-05-11 kinaba: { 2ba3bf09a0 2013-05-11 kinaba: for(int a=0; a<x; ++a) { 2ba3bf09a0 2013-05-11 kinaba: int req = 1; 2ba3bf09a0 2013-05-11 kinaba: if(0<=a-1&&a-1<W) req = max(req, td[y][a-1]+1); 2ba3bf09a0 2013-05-11 kinaba: if(0<=y-1&&y-1<H) req = max(req, td[y-1][a]+1); 2ba3bf09a0 2013-05-11 kinaba: if(fixed[y][a]) { 2ba3bf09a0 2013-05-11 kinaba: if(fixed[y][a] < req) 2ba3bf09a0 2013-05-11 kinaba: goto label_td_end; 2ba3bf09a0 2013-05-11 kinaba: td[y][a] = fixed[y][a]; 2ba3bf09a0 2013-05-11 kinaba: } else { 2ba3bf09a0 2013-05-11 kinaba: td[y][a] = req; 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: for(int a=W-1; a>x; --a) { 2ba3bf09a0 2013-05-11 kinaba: int req = 1; 2ba3bf09a0 2013-05-11 kinaba: if(0<=a+1&&a+1<W) req = max(req, td[y][a+1]+1); 2ba3bf09a0 2013-05-11 kinaba: if(0<=y-1&&y-1<H) req = max(req, td[y-1][a]+1); 2ba3bf09a0 2013-05-11 kinaba: if(fixed[y][a]) { 2ba3bf09a0 2013-05-11 kinaba: if(fixed[y][a] < req) 2ba3bf09a0 2013-05-11 kinaba: goto label_td_end; 2ba3bf09a0 2013-05-11 kinaba: td[y][a] = fixed[y][a]; 2ba3bf09a0 2013-05-11 kinaba: } else { 2ba3bf09a0 2013-05-11 kinaba: td[y][a] = req; 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: int a = x; 2ba3bf09a0 2013-05-11 kinaba: { 2ba3bf09a0 2013-05-11 kinaba: int req = 1; 2ba3bf09a0 2013-05-11 kinaba: if(0<=a-1&&a-1<W) req = max(req, td[y][a-1]+1); 2ba3bf09a0 2013-05-11 kinaba: if(0<=a+1&&a+1<W) req = max(req, td[y][a+1]+1); 2ba3bf09a0 2013-05-11 kinaba: if(0<=y-1&&y-1<H) req = max(req, td[y-1][a]+1); 2ba3bf09a0 2013-05-11 kinaba: if(fixed[y][a]) { 2ba3bf09a0 2013-05-11 kinaba: if(fixed[y][a] < req) 2ba3bf09a0 2013-05-11 kinaba: goto label_td_end; 2ba3bf09a0 2013-05-11 kinaba: td[y][a] = fixed[y][a]; 2ba3bf09a0 2013-05-11 kinaba: } else { 2ba3bf09a0 2013-05-11 kinaba: td[y][a] = req; 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: td_sum[y] = accumulate(td[y].begin(), td[y].end(), 0); 2ba3bf09a0 2013-05-11 kinaba: td_end ++; 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: label_td_end:; 2ba3bf09a0 2013-05-11 kinaba: 2ba3bf09a0 2013-05-11 kinaba: vector< vector<int> > bu(H, vector<int>(W)); 2ba3bf09a0 2013-05-11 kinaba: vector<int> bu_sum(H); 2ba3bf09a0 2013-05-11 kinaba: int bu_begin = H; 2ba3bf09a0 2013-05-11 kinaba: for(int y=H-1; y>=0; --y) 2ba3bf09a0 2013-05-11 kinaba: { 2ba3bf09a0 2013-05-11 kinaba: for(int a=0; a<x; ++a) { 2ba3bf09a0 2013-05-11 kinaba: int req = 1; 2ba3bf09a0 2013-05-11 kinaba: if(0<=a-1&&a-1<W) req = max(req, bu[y][a-1]+1); 2ba3bf09a0 2013-05-11 kinaba: if(0<=y+1&&y+1<H) req = max(req, bu[y+1][a]+1); 2ba3bf09a0 2013-05-11 kinaba: if(fixed[y][a]) { 2ba3bf09a0 2013-05-11 kinaba: if(fixed[y][a] < req) 2ba3bf09a0 2013-05-11 kinaba: goto label_bu_end; 2ba3bf09a0 2013-05-11 kinaba: bu[y][a] = fixed[y][a]; 2ba3bf09a0 2013-05-11 kinaba: } else { 2ba3bf09a0 2013-05-11 kinaba: bu[y][a] = req; 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: for(int a=W-1; a>x; --a) { 2ba3bf09a0 2013-05-11 kinaba: int req = 1; 2ba3bf09a0 2013-05-11 kinaba: if(0<=a+1&&a+1<W) req = max(req, bu[y][a+1]+1); 2ba3bf09a0 2013-05-11 kinaba: if(0<=y+1&&y+1<H) req = max(req, bu[y+1][a]+1); 2ba3bf09a0 2013-05-11 kinaba: if(fixed[y][a]) { 2ba3bf09a0 2013-05-11 kinaba: if(fixed[y][a] < req) 2ba3bf09a0 2013-05-11 kinaba: goto label_bu_end; 2ba3bf09a0 2013-05-11 kinaba: bu[y][a] = fixed[y][a]; 2ba3bf09a0 2013-05-11 kinaba: } else { 2ba3bf09a0 2013-05-11 kinaba: bu[y][a] = req; 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: int a = x; 2ba3bf09a0 2013-05-11 kinaba: { 2ba3bf09a0 2013-05-11 kinaba: int req = 1; 2ba3bf09a0 2013-05-11 kinaba: if(0<=a-1&&a-1<W) req = max(req, bu[y][a-1]+1); 2ba3bf09a0 2013-05-11 kinaba: if(0<=a+1&&a+1<W) req = max(req, bu[y][a+1]+1); 2ba3bf09a0 2013-05-11 kinaba: if(0<=y+1&&y+1<H) req = max(req, bu[y+1][a]+1); 2ba3bf09a0 2013-05-11 kinaba: if(fixed[y][a]) { 2ba3bf09a0 2013-05-11 kinaba: if(fixed[y][a] < req) 2ba3bf09a0 2013-05-11 kinaba: goto label_bu_end; 2ba3bf09a0 2013-05-11 kinaba: bu[y][a] = fixed[y][a]; 2ba3bf09a0 2013-05-11 kinaba: } else { 2ba3bf09a0 2013-05-11 kinaba: bu[y][a] = req; 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: bu_sum[y] = accumulate(bu[y].begin(), bu[y].end(), 0); 2ba3bf09a0 2013-05-11 kinaba: bu_begin --; 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: label_bu_end:; 2ba3bf09a0 2013-05-11 kinaba: 2ba3bf09a0 2013-05-11 kinaba: if(td_end <= bu_begin) 2ba3bf09a0 2013-05-11 kinaba: continue; 2ba3bf09a0 2013-05-11 kinaba: 2ba3bf09a0 2013-05-11 kinaba: int baseline = 0; 2ba3bf09a0 2013-05-11 kinaba: for(int Y=0; Y<H; ++Y) 2ba3bf09a0 2013-05-11 kinaba: baseline += (Y<bu_begin ? td_sum[Y] : Y==bu_begin ? 0 : bu_sum[Y]); 2ba3bf09a0 2013-05-11 kinaba: 2ba3bf09a0 2013-05-11 kinaba: for(int y=bu_begin; y<td_end; ++y) 2ba3bf09a0 2013-05-11 kinaba: { 2ba3bf09a0 2013-05-11 kinaba: int score = baseline; 2ba3bf09a0 2013-05-11 kinaba: for(int x=0; x<W; ++x) 2ba3bf09a0 2013-05-11 kinaba: score += max(td[y][x], bu[y][x]); 2ba3bf09a0 2013-05-11 kinaba: best = min(best, score); 2ba3bf09a0 2013-05-11 kinaba: if(y<H) 2ba3bf09a0 2013-05-11 kinaba: baseline += td_sum[y] - bu_sum[y+1]; 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: return (best==INF ? -1 : best); 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: }; 2ba3bf09a0 2013-05-11 kinaba: 2ba3bf09a0 2013-05-11 kinaba: // BEGIN CUT HERE 2ba3bf09a0 2013-05-11 kinaba: #include <ctime> 2ba3bf09a0 2013-05-11 kinaba: double start_time; string timer() 2ba3bf09a0 2013-05-11 kinaba: { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); } 2ba3bf09a0 2013-05-11 kinaba: template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) 2ba3bf09a0 2013-05-11 kinaba: { os << "{ "; 2ba3bf09a0 2013-05-11 kinaba: for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it) 2ba3bf09a0 2013-05-11 kinaba: os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; } 2ba3bf09a0 2013-05-11 kinaba: void verify_case(const int& Expected, const int& Received) { 2ba3bf09a0 2013-05-11 kinaba: bool ok = (Expected == Received); 2ba3bf09a0 2013-05-11 kinaba: if(ok) cerr << "PASSED" << timer() << endl; else { cerr << "FAILED" << timer() << endl; 2ba3bf09a0 2013-05-11 kinaba: cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } } 2ba3bf09a0 2013-05-11 kinaba: #define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock(); 2ba3bf09a0 2013-05-11 kinaba: #define END verify_case(_, TheMountain().minSum(n, m, rowIndex, columnIndex, element));} 2ba3bf09a0 2013-05-11 kinaba: int main(){ 2ba3bf09a0 2013-05-11 kinaba: 2ba3bf09a0 2013-05-11 kinaba: CASE(0) 2ba3bf09a0 2013-05-11 kinaba: int n = 2; 2ba3bf09a0 2013-05-11 kinaba: int m = 3; 2ba3bf09a0 2013-05-11 kinaba: int rowIndex_[] = {0, 0, 0, 1, 1, 1}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> rowIndex(rowIndex_, rowIndex_+sizeof(rowIndex_)/sizeof(*rowIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int columnIndex_[] = {0, 1, 2, 0, 1, 2}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> columnIndex(columnIndex_, columnIndex_+sizeof(columnIndex_)/sizeof(*columnIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int element_[] = {4, 6, 9, 1, 3, 6}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> element(element_, element_+sizeof(element_)/sizeof(*element_)); 2ba3bf09a0 2013-05-11 kinaba: int _ = 29; 2ba3bf09a0 2013-05-11 kinaba: END 2ba3bf09a0 2013-05-11 kinaba: CASE(1) 2ba3bf09a0 2013-05-11 kinaba: int n = 2; 2ba3bf09a0 2013-05-11 kinaba: int m = 3; 2ba3bf09a0 2013-05-11 kinaba: int rowIndex_[] = {1, 0, 1}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> rowIndex(rowIndex_, rowIndex_+sizeof(rowIndex_)/sizeof(*rowIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int columnIndex_[] = {2, 2, 0}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> columnIndex(columnIndex_, columnIndex_+sizeof(columnIndex_)/sizeof(*columnIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int element_[] = {5, 7, 6}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> element(element_, element_+sizeof(element_)/sizeof(*element_)); 2ba3bf09a0 2013-05-11 kinaba: int _ = 40; 2ba3bf09a0 2013-05-11 kinaba: END 2ba3bf09a0 2013-05-11 kinaba: CASE(2) 2ba3bf09a0 2013-05-11 kinaba: int n = 3; 2ba3bf09a0 2013-05-11 kinaba: int m = 3; 2ba3bf09a0 2013-05-11 kinaba: int rowIndex_[] = {0, 0, 2, 2}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> rowIndex(rowIndex_, rowIndex_+sizeof(rowIndex_)/sizeof(*rowIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int columnIndex_[] = {0, 2, 2, 0}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> columnIndex(columnIndex_, columnIndex_+sizeof(columnIndex_)/sizeof(*columnIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int element_[] = {1, 1, 1, 1}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> element(element_, element_+sizeof(element_)/sizeof(*element_)); 2ba3bf09a0 2013-05-11 kinaba: int _ = 15; 2ba3bf09a0 2013-05-11 kinaba: END 2ba3bf09a0 2013-05-11 kinaba: CASE(3) 2ba3bf09a0 2013-05-11 kinaba: int n = 2; 2ba3bf09a0 2013-05-11 kinaba: int m = 2; 2ba3bf09a0 2013-05-11 kinaba: int rowIndex_[] = {0, 0, 1, 1}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> rowIndex(rowIndex_, rowIndex_+sizeof(rowIndex_)/sizeof(*rowIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int columnIndex_[] = {0, 1, 1, 0}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> columnIndex(columnIndex_, columnIndex_+sizeof(columnIndex_)/sizeof(*columnIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int element_[] = {5, 8, 5, 8}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> element(element_, element_+sizeof(element_)/sizeof(*element_)); 2ba3bf09a0 2013-05-11 kinaba: int _ = -1; 2ba3bf09a0 2013-05-11 kinaba: END 2ba3bf09a0 2013-05-11 kinaba: CASE(4) 2ba3bf09a0 2013-05-11 kinaba: int n = 1; 2ba3bf09a0 2013-05-11 kinaba: int m = 3; 2ba3bf09a0 2013-05-11 kinaba: int rowIndex_[] = {0}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> rowIndex(rowIndex_, rowIndex_+sizeof(rowIndex_)/sizeof(*rowIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int columnIndex_[] = {1}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> columnIndex(columnIndex_, columnIndex_+sizeof(columnIndex_)/sizeof(*columnIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int element_[] = {1}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> element(element_, element_+sizeof(element_)/sizeof(*element_)); 2ba3bf09a0 2013-05-11 kinaba: int _ = -1; 2ba3bf09a0 2013-05-11 kinaba: END 2ba3bf09a0 2013-05-11 kinaba: CASE(5) 2ba3bf09a0 2013-05-11 kinaba: int n = 123; 2ba3bf09a0 2013-05-11 kinaba: int m = 45; 2ba3bf09a0 2013-05-11 kinaba: int rowIndex_[] = {2, 3, 5, 7, 11}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> rowIndex(rowIndex_, rowIndex_+sizeof(rowIndex_)/sizeof(*rowIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int columnIndex_[] = {13, 17, 19, 23, 29}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> columnIndex(columnIndex_, columnIndex_+sizeof(columnIndex_)/sizeof(*columnIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int element_[] = {100, 200, 300, 400, 500}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> element(element_, element_+sizeof(element_)/sizeof(*element_)); 2ba3bf09a0 2013-05-11 kinaba: int _ = 367047; 2ba3bf09a0 2013-05-11 kinaba: END 2ba3bf09a0 2013-05-11 kinaba: CASE(6) 2ba3bf09a0 2013-05-11 kinaba: int n = 200; 2ba3bf09a0 2013-05-11 kinaba: int m = 200; 2ba3bf09a0 2013-05-11 kinaba: int rowIndex_[] = {5}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> rowIndex(rowIndex_, rowIndex_+sizeof(rowIndex_)/sizeof(*rowIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int columnIndex_[] = {8}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> columnIndex(columnIndex_, columnIndex_+sizeof(columnIndex_)/sizeof(*columnIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int element_[] = {666}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> element(element_, element_+sizeof(element_)/sizeof(*element_)); 2ba3bf09a0 2013-05-11 kinaba: int _ = 5737554; 2ba3bf09a0 2013-05-11 kinaba: END 2ba3bf09a0 2013-05-11 kinaba: CASE(7) 2ba3bf09a0 2013-05-11 kinaba: int n = 10; 2ba3bf09a0 2013-05-11 kinaba: int m = 10; 2ba3bf09a0 2013-05-11 kinaba: int rowIndex_[] = {0, 8, 7}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> rowIndex(rowIndex_, rowIndex_+sizeof(rowIndex_)/sizeof(*rowIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int columnIndex_[] = {3, 1, 9}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> columnIndex(columnIndex_, columnIndex_+sizeof(columnIndex_)/sizeof(*columnIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int element_[] = {5, 4, 7}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> element(element_, element_+sizeof(element_)/sizeof(*element_)); 2ba3bf09a0 2013-05-11 kinaba: int _ = 593; 2ba3bf09a0 2013-05-11 kinaba: END 2ba3bf09a0 2013-05-11 kinaba: CASE(8) 2ba3bf09a0 2013-05-11 kinaba: int n = 200; 2ba3bf09a0 2013-05-11 kinaba: int m = 200; 2ba3bf09a0 2013-05-11 kinaba: int rowIndex_[] = {129,99,142,33,111,174,169,176,83,143,70,116,193,139,7,35,111,4,189,111,170,29,16,87,115,4,60,71,37,138,128,38,61,176,187,66,64,84,120,104,124,129,91,137,114,187,97,115,151,140}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> rowIndex(rowIndex_, rowIndex_+sizeof(rowIndex_)/sizeof(*rowIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int columnIndex_[] = {191,148,194,13,90,17,185,163,17,170,193,165,140,158,85,15,56,91,9,68,153,83,9,97,74,40,160,165,49,151,173,98,123,44,139,164,66,112,141,172,91,147,71,167,123,53,189,86,71,171}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> columnIndex(columnIndex_, columnIndex_+sizeof(columnIndex_)/sizeof(*columnIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int element_[] = {953,216,307,197,970,590,659,153,79,262,628,153,106,904,888,249,224,839,29,327,664,619,387,325,865,849,516,313,649,135,713,585,347,279,702,837,682,817,844,981,401,410,982,891,167,102,646,73,784,455}; 2ba3bf09a0 2013-05-11 kinaba: vector <int> element(element_, element_+sizeof(element_)/sizeof(*element_)); 2ba3bf09a0 2013-05-11 kinaba: int _ = -1; 2ba3bf09a0 2013-05-11 kinaba: END 2ba3bf09a0 2013-05-11 kinaba: /* 2ba3bf09a0 2013-05-11 kinaba: CASE(9) 2ba3bf09a0 2013-05-11 kinaba: int n = ; 2ba3bf09a0 2013-05-11 kinaba: int m = ; 2ba3bf09a0 2013-05-11 kinaba: int rowIndex_[] = ; 2ba3bf09a0 2013-05-11 kinaba: vector <int> rowIndex(rowIndex_, rowIndex_+sizeof(rowIndex_)/sizeof(*rowIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int columnIndex_[] = ; 2ba3bf09a0 2013-05-11 kinaba: vector <int> columnIndex(columnIndex_, columnIndex_+sizeof(columnIndex_)/sizeof(*columnIndex_)); 2ba3bf09a0 2013-05-11 kinaba: int element_[] = ; 2ba3bf09a0 2013-05-11 kinaba: vector <int> element(element_, element_+sizeof(element_)/sizeof(*element_)); 2ba3bf09a0 2013-05-11 kinaba: int _ = ; 2ba3bf09a0 2013-05-11 kinaba: END 2ba3bf09a0 2013-05-11 kinaba: */ 2ba3bf09a0 2013-05-11 kinaba: } 2ba3bf09a0 2013-05-11 kinaba: // END CUT HERE