제출 #1226576

#제출 시각아이디문제언어결과실행 시간메모리
1226576ByeWorldTreasure (different grader from official contest) (CEOI13_treasure2)C++20
100 / 100
1 ms840 KiB
#include "treasure.h"
#include <bits/stdc++.h>
// #pragma GCC optimize("O3")
#define ll long long
#define se second
#define fi first
#define pb push_back
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
#define que countTreasure
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,pii> ipii;
const int MAXN = 1e5+10;
const int SQRT = 450;
const int INF = 1e9+100;
const int LOG = 20;
void chmn(int &a, int b){ a = min(a, b); }
void chmx(int &a, int b){ a = max(a, b); }

int n, pr[1010][1010];

void findTreasure (int N) {
	n = N;
	int x = n/2;
	for(int i=n; i>=1; i--){
		for(int j=n; j>=1; j--){
			if(i>x && j>x){
				pr[i][j] = que(1,1,i,j);
			} else if(i<=x && j>x){
				pr[i][j] = pr[n][j]-que(i+1,1,n,j);
			} else if(i>x && j<=x){
				pr[i][j] = pr[i][n]-que(1,j+1,i,n);
			} else {
				// cout << i << ' '<< j << ' '<< que(i,j,n,n) << " p\n";
				pr[i][j] = que(i+1,j+1,n,n)+pr[i][n]+pr[n][j]-pr[n][n];
			}
		}
	}
	// for(int i=1; i<=n; i++)
	// 	for(int j=1; j<=n; j++) cout << pr[i][j] <<" \n"[j==n];
	for(int i=1; i<=n; i++)
		for(int j=1; j<=n; j++)
			if(pr[i][j]-pr[i-1][j]-pr[i][j-1]+pr[i-1][j-1])
				Report(i, j);
			
}
#Verdict Execution timeMemoryGrader output
Fetching results...