Submission #140434

#TimeUsernameProblemLanguageResultExecution timeMemory
140434silxikysTreasure (different grader from official contest) (CEOI13_treasure2)C++14
26 / 100
3 ms504 KiB
#include <bits/stdc++.h> #include "treasure.h" using namespace std; using ll = long long; const int maxn = 105; int g[maxn][maxn]; void recurse(int r1, int c1, int r2, int c2) { int r = countTreasure(r1,c1,r2,c2); if (r == (r2-r1+1)*(c2-c1+1)) { //all filled for (int i = r1; i <= r2; i++) { for (int j = c1; j <= c2; j++) { g[i][j] = 1; } } return; } else if (r == 0) { return; } else { if (r1 == r2) { int m = (c1+c2)/2; recurse(r1,c1,r2,m); recurse(r1,m+1,r2,c2); } else { int m = (r1+r2)/2; recurse(r1,c1,m,c2); recurse(m+1,c1,r2,c2); } } } void findTreasure (int N) { recurse(1,1,N,N); for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { if (g[i][j] == 1) Report(i,j); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...