제출 #126600

#제출 시각아이디문제언어결과실행 시간메모리
126600eriksuenderhauf보물 찾기 (CEOI13_treasure2)C++11
0 / 100
2 ms376 KiB
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "treasure.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i])
#define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vil vector<pil>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e2 + 5;
const double eps = 1e-9;
int a[MAXN][MAXN], n;
map<pair<pii,pii>,int> dp;

int qry(int x1, int y1, int x2, int y2) {
	if (dp.count(mp(mp(x1,y1),mp(x2,y2)))) return dp[mp(mp(x1,y1),mp(x2,y2))];
	//printf("%d %d %d %d\n", x1, y1, x2, y2); fflush(stdout);
	int ret = countTreasure(x1, y1, x2, y2);// scanf("%d", &ret);
	dp[mp(mp(x1,y1),mp(x2,y2))] = ret;
	return ret;
}

int f(int i, int j) {
	int tl = i * j + (i-1) * j + i * (j-1) + (i-1)*(j-1);
	int bl = (n-i+1)*j+(n-i)*j+(n-i+1)*(j-1)+(n-i)*(j-1);
	int tr = i*(n-j+1)+(i-1)*(n-j+1)+i*(n-j)+(i-1)*(n-j);
	int br = (n-i+1)*(n-j+1)+(n-i)*(n-j+1)+(n-i+1)*(n-j)+(n-i)*(n-j);
	int mx = max(max(tl,bl), max(tr, br)), ret = 0;
	/*if (mx == tl)
		return qry(1,1,i,j)-qry(1,1,i-1,j)-qry(1,1,i,j-1)+qry(1,1,i-1,j-1);
	if (mx == bl)
		return qry(i,1,n,j)-qry(i+1,1,n,j)-qry(i,1,n,j-1)+qry(i+1,1,n,j-1);
	if (mx == tr)
		return qry(1,j,i,n)-qry(1,j,i-1,n)-qry(1,j+1,i,n)+qry(1,j+1,i-1,n);*/
	return qry(i,j,n,n)-qry(i+1,j,n,n)-qry(i,j+1,n,n)+qry(i+1,j+1,n,n);
}

void findTreasure(int N) {
	n = N;
	//ni(n);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			a[i][j] = f(i, j);
	//printf("END\n");
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++)
			if (a[i][j])
				Report(i, j);
			//printf("%d", a[i][j]);
		//printf("\n");
	}
	//fflush(stdout);
	//return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

treasure.cpp: In function 'int f(int, int)':
treasure.cpp:54:6: warning: unused variable 'mx' [-Wunused-variable]
  int mx = max(max(tl,bl), max(tr, br)), ret = 0;
      ^~
treasure.cpp:54:41: warning: unused variable 'ret' [-Wunused-variable]
  int mx = max(max(tl,bl), max(tr, br)), ret = 0;
                                         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...