Submission #68528

# Submission time Handle Problem Language Result Execution time Memory
68528 2018-08-17T09:08:45 Z Pajaraja Treasure (different grader from official contest) (CEOI13_treasure2) C++17
46 / 100
4 ms 596 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,sy+1,sx,y2);
	if(sx<x2) k3=countTreasure(sx+1,y1,x2,sy);
	rek(x1,y1,sx,sy,k1);
	rek(x1,sy+1,sx,y2,k2);
	rek(sx+1,y1,x2,sy,k3);
	rek(sx+1,sy+1,x2,y2,k-k1-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 = 574, score = 1
2 Partially correct 2 ms 356 KB Output is partially correct - N = 10, K = 8623, score = 1
3 Correct 2 ms 432 KB Output is correct - N = 15, K = 20064, score = 10
4 Correct 2 ms 432 KB Output is correct - N = 16, K = 21046, score = 10
5 Partially correct 2 ms 508 KB Output is partially correct - N = 55, K = 8450116, score = 1
6 Partially correct 2 ms 544 KB Output is partially correct - N = 66, K = 17512715, score = 1
7 Correct 3 ms 592 KB Output is correct - N = 77, K = 7505625, score = 10
8 Correct 4 ms 596 KB Output is correct - N = 88, K = 9818645, score = 10
9 Partially correct 2 ms 596 KB Output is partially correct - N = 99, K = 90441086, score = 1
10 Partially correct 3 ms 596 KB Output is partially correct - N = 100, K = 95317319, score = 1