# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
42492 | nonocut | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 6 ms | 1884 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "treasure.h"
#include<bits/stdc++.h>
using namespace std;
int s[105][105];
map<int,map<int,map<int,map<int,int>>>> mp;
int get(int r1,int c1,int r2,int c2) {
if(!mp[r1][c1][r2][c2]) mp[r1][c1][r2][c2] = countTreasure(r1,c1,r2,c2);
return mp[r1][c1][r2][c2];
}
void findTreasure (int N) {
//section 4
for(int i=N/2+1;i<=N;i++) {
for(int j=N/2+1;j<=N;j++) {
s[i][j] = get(1,1,i,j);
}
}
//section 3
for(int i=1;i<=N/2;i++) {
for(int j=N/2+1;j<=N;j++) {
s[i][j] = s[N][j] - get(i+1,1,N,j);
}
}
//section 2
for(int i=N/2+1;i<=N;i++) {
for(int j=1;j<=N/2;j++) {
s[i][j] = s[i][N] - get(1,j+1,i,N);
}
}
//section1
for(int i=1;i<=N/2;i++) {
for(int j=1;j<=N/2;j++) {
s[i][j] = s[N][j] + s[i][N] + get(i+1,j+1,N,N) - s[N][N];
}
}
for(int i=1;i<=N;i++) {
for(int j=1;j<=N;j++) {
if(s[i][j]-s[i-1][j]-s[i][j-1]+s[i-1][j-1]) Report(i,j);
// printf("%d ",s[i][j]);
}
// printf("\n");
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |