# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
68668 | Pajaraja | 보물 찾기 (CEOI13_treasure2) | C++17 | 3 ms | 768 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "treasure.h"
#include <bits/stdc++.h>
using namespace std;
int t[107][107],n;
void rek(int x1,int y1,int x2,int y2,int k)
{
if(x2<x1 || y2<y1 || x2>n || y2>n) return;
if(k==(x2-x1+1)*(y2-y1+1))
{
for(int i=x1;i<=x2;i++) for(int j=y1;j<=y2;j++) t[i][j]=1;
return;
}
if(k==0)
{
for(int i=x1;i<=x2;i++) for(int j=y1;j<=y2;j++) t[i][j]=0;
return;
}
int sx=(x1+x2)/2,sy=(y1+y2)/2;
int k1=0,k2=0,k3=0;
k1=countTreasure(x1,y1,sx,sy);
if(sy<y2) k2=countTreasure(x1,y1,sx,y2);
else k2=k1;
if(sx<x2) k3=countTreasure(sx+1,y1,x2,sy);
rek(x1,y1,sx,sy,k1);
rek(x1,sy+1,sx,y2,k2-k1);
rek(sx+1,y1,x2,sy,k3);
rek(sx+1,sy+1,x2,y2,k-k2-k3);
}
void findTreasure (int N)
{
n=N;
rek(1,1,n,n,countTreasure(1,1,n,n));
for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) if(t[i][j]==1) Report(i,j);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |