Submission #63428

#TimeUsernameProblemLanguageResultExecution timeMemory
63428bazsi700Treasure (different grader from official contest) (CEOI13_treasure2)C++14
80 / 100
4 ms720 KiB
#include <bits/stdc++.h> #include "treasure.h" using namespace std; #define MOD 1000000007 #define ll long long int #define vi vector<int> #define vii vector< vector<int> > #define PI 3.1415926535897932384626433832795 #define INF 9223372036854775807LL //16:20 bool table[105][105]; int query(int r1, int c1, int r2, int c2) { return countTreasure(r1,c1,r2,c2); /*cout << r1 << " " << c1 << " " << r2 << " " << c2 << "\n" << flush; int x; cin >> x; return x;*/ } int cn[105][105]; int cn1[105][105]; int cn2[105][105]; int cn3[105][105]; int cn4[105][105]; void findTreasure(int n) { if(n <= 10) { for(int i = 1; i <= n; i++) { int brokeat = -1; for(int j = n; j >= 1; j--) { cn[i][j] = query(1,1,i,j); if(cn[i][j] == cn[i-1][j]) { brokeat = j; break; } } if(brokeat != -1) { for(int j = brokeat; j >= 1; j--) { cn[i][j] = cn[i-1][j]; } } } for(int i = 1; i <= n; i++) { for(int j = 1; j <= n; j++) { if(cn[i][j]-(cn[i-1][j]+cn[i][j-1]-cn[i-1][j-1])) { Report(i,j); } } } return; } for(int i = n/2; i <= n; i++) { for(int j = n/2; j <= n; j++) { cn1[i][j] = query(1,1,i,j); } } for(int i = n/2; i <= n; i++) { for(int j = 1; j <= n/2+1; j++) { cn2[i][j] = query(1,j,i,n); } } for(int i = 1; i <= n/2+1; i++) { for(int j = n/2; j <= n; j++) { cn3[i][j] = query(i,1,n,j); } } for(int i = 1; i <= n/2+1; i++) { for(int j = 1; j <= n/2+1; j++) { cn4[i][j] = query(i,j,n,n); } } for(int i = 1; i <= n/2; i++) { for(int j = 1; j <= n/2; j++) { if(cn4[i][j]-(cn4[i+1][j]+cn4[i][j+1]-cn4[i+1][j+1])) { Report(i,j); } } } for(int i = n/2+1; i <= n; i++) { for(int j = 1; j <= n/2; j++) { if(cn2[i][j]-(cn2[i-1][j]+cn2[i][j+1]-cn2[i-1][j+1])) { Report(i,j); } } } for(int i = 1; i <= n/2; i++) { for(int j = n/2+1; j <= n; j++) { if(cn3[i][j]-(cn3[i+1][j]+cn3[i][j-1]-cn3[i+1][j-1])) { Report(i,j); } } } for(int i = n/2+1; i <= n; i++) { for(int j = n/2+1; j <= n; j++) { if(cn1[i][j]-(cn1[i-1][j]+cn1[i][j-1]-cn1[i-1][j-1])) { Report(i,j); } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...