# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
65537 | IvanC | Treasure (different grader from official contest) (CEOI13_treasure2) | C++17 | 3 ms | 620 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "treasure.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 110;
static int matriz[MAXN][MAXN];
void solve(int x,int left,int right,int cnt){
if(cnt == 0) return;
if(right - left + 1 == cnt){
for(int i = left;i<=right;i++){
matriz[x][i] = 1;
}
return;
}
int mid = (left+right)/2;
int qt = countTreasure(x,left,x,mid);
solve(x,left,mid,qt);
solve(x,mid+1,right,cnt - qt);
}
void findTreasure(int N){
memset(matriz,0,sizeof(matriz));
int cnt = countTreasure(1, 1, N, N);
int last = 0;
for(int i = 1;i<=N;i++){
int novo = countTreasure(1,1,i,N);
solve(i,1,N,novo - last);
last = novo;
}
for(int i = 1;i<=N;i++){
for(int j = 1;j<=N;j++){
if(matriz[i][j]) Report(i,j);
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |