# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
43495 | Hassoony | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 20 ms | 19680 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<bits/stdc++.h>
#include "treasure.h"
using namespace std;
typedef long long ll;
const int MX=102;
int grid[MX][MX],n;
bool is[MX][MX][MX][MX];
void calc(int x1,int y1,int x2,int y2,int how){
if(!how)return;
if(x1==x2&&y1==y2){
if(how==1){
grid[x1][y1]=1;
}
return;
}
if(x1==x2){
int mid=(y1+y2)/2;
if(!is[x1][y1][x2][mid]){
int x=countTreasure(x1,y1,x2,mid);
is[x1][y1][x2][mid]=1;
calc(x1,y1,x2,mid,x);
}
if(mid+1>y2)return;
if(!is[x1][mid+1][x2][y2]){
int x=countTreasure(x1,mid+1,x2,y2);
is[x1][mid+1][x2][y2]=1;
calc(x1,mid+1,x2,y2,x);
}
return;
}
int mid=(x1+x2)/2;
if(!is[x1][y1][mid][y2]){
int x=countTreasure(x1,y1,mid,y2);
is[x1][y1][mid][y2]=1;
calc(x1,y1,mid,x2,x);
}
if(mid+1>x2)return;
if(!is[mid+1][y1][x2][y2]){
int x=countTreasure(mid+1,y1,x2,y2);
is[mid+1][y1][x2][y2]=1;
calc(mid+1,y1,x2,y2,x);
}
}
void findTreasure (int N) {
n=N;
int x=countTreasure(1,1,n,n);
calc(1,1,n,n,x);
puts("END");
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
cout<<grid[i][j];
}
puts("");
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |