Submission #68668

# Submission time Handle Problem Language Result Execution time Memory
68668 2018-08-17T22:15:11 Z Pajaraja Treasure (different grader from official contest) (CEOI13_treasure2) C++17
46 / 100
3 ms 768 KB
#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
1 Partially correct 2 ms 248 KB Output is partially correct - N = 5, K = 553, score = 1
2 Partially correct 2 ms 356 KB Output is partially correct - N = 10, K = 8519, score = 1
3 Correct 2 ms 432 KB Output is correct - N = 15, K = 19884, score = 10
4 Correct 2 ms 508 KB Output is correct - N = 16, K = 20865, score = 10
5 Partially correct 2 ms 524 KB Output is partially correct - N = 55, K = 8445211, score = 1
6 Partially correct 3 ms 588 KB Output is partially correct - N = 66, K = 17505890, score = 1
7 Correct 3 ms 768 KB Output is correct - N = 77, K = 7498714, score = 10
8 Correct 3 ms 768 KB Output is correct - N = 88, K = 9809834, score = 10
9 Partially correct 3 ms 768 KB Output is partially correct - N = 99, K = 90422659, score = 1
10 Partially correct 3 ms 768 KB Output is partially correct - N = 100, K = 95298493, score = 1