Submission #65536

#TimeUsernameProblemLanguageResultExecution timeMemory
65536IvanCTreasure (different grader from official contest) (CEOI13_treasure2)C++17
62 / 100
3 ms720 KiB
#include "treasure.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 110; static int matriz[MAXN][MAXN]; void solve(int lx,int rx,int ly,int ry,int divide_x,int cnt){ if(cnt == 0) return; if((rx - lx + 1)*(ry - ly + 1) == cnt){ for(int i = lx;i<=rx;i++){ for(int j = ly;j <= ry;j++){ matriz[i][j] = 1; } } return; } if(divide_x){ int mx = (lx + rx)/2; int qt = countTreasure(lx,ly,mx,ry); solve(lx,mx,ly,ry,0,qt); solve(mx+1,rx,ly,ry,0,cnt - qt); } else{ int my = (ly + ry)/2; int qt = countTreasure(lx,ly,rx,my); solve(lx,rx,ly,my,1,qt); solve(lx,rx,my+1,ry,1,cnt - qt); } } void findTreasure(int N){ memset(matriz,0,sizeof(matriz)); int cnt = countTreasure(1, 1, N, N); solve(1,N,1,N,0,cnt); for(int i = 1;i<=N;i++){ for(int j = 1;j<=N;j++){ if(matriz[i][j]) Report(i,j); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...