# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91912 | easrui | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 2 ms | 436 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 <bits/stdc++.h>
#include "treasure.h"
using namespace std;
int S[101][101]; // S[a][b] a행 b열까지합
void findTreasure(int N){
static int S[101][101]; // S[a][b] a행 b열까지합
int L,R,U,D,tmp,res;
L=1,R=N,U=1,D=N;
int x = countTreasure(1,L,N,R);
tmp = x;
for(U=2,D=N;U<=N/2+1;U++){
res = countTreasure(U,L,D,R);
if(L==1){
S[U-1][R] = tmp - res;
}
else S[U-1][L-1] = S[U-1][N] - (tmp - res);
tmp = res;
}
tmp = x;
for(U=1,D=N-1;D>=(N+1)/2;D--){
res = countTreasure(U,L,D,R);
if(L==1) S[D+1][R] = tmp - res;
else S[D+1][L-1] = S[D+1][N] - (tmp - res);
tmp = res;
}
int t=0;
for(int i=1; i<=D; i++) t+=S[i][R];
if(L==1) S[D+1][R] = tmp - t;
else S[D+1][L-1] = S[D+1][N] - (tmp - t);
for(L=2,R=N;L<=N/2+1;L++){
int x = countTreasure(1,L,N,R);
tmp = x;
for(U=2,D=N;U<=N/2+1;U++){
res = countTreasure(U,L,D,R);
if(L==1) S[U-1][R] = tmp - res;
else S[U-1][L-1] = S[U-1][N] - (tmp - res);
tmp = res;
}
tmp = x;
for(U=1,D=N-1;D>=(N+1)/2;D--){
res = countTreasure(U,L,D,R);
if(L==1) S[D+1][R] = tmp - res;
else S[D+1][L-1] = S[D+1][N] - (tmp - res);
tmp = res;
}
int t=0;
for(int i=1; i<=D; i++) t+=S[i][R]-S[i][L-1];
if(L==1) S[D+1][R] = tmp - t;
else S[D+1][L-1] = S[D+1][N] - (tmp - t);
//printf("%d %d",D+1,L-1);
}
for(L=1,R=N-1;R>=(N+1)/2;R--){
int x = countTreasure(1,L,N,R);
tmp = x;
for(U=2,D=N;U<=N/2+1;U++){
res = countTreasure(U,L,D,R);
if(L==1) S[U-1][R] = tmp - res;
else S[U-1][L-1] = S[U-1][N] - (tmp - res);
tmp = res;
//int t=0;
//for(int i=1; i<=R-1; i++) t+=S[U-1][i];
//if(R-1<(N+1)/2) S[U-1][R-1] = S[U-1][R] - t;
}
tmp = x;
for(U=1,D=N-1;D>=(N+1)/2;D--){
res = countTreasure(U,L,D,R);
if(L==1){
S[D+1][R] = tmp - res;
//printf("%d %d %d\n",S[D+1][R],D+1,R);
}
else S[D+1][L-1] = S[D+1][N] - (tmp - res);
tmp = res;
//int t=0;
//for(int i=1; i<=R-1; i++) t+=S[D+1][i];
//if(R-1<(N+1)/2) S[D+1][R-1] = S[D+1][R] - t;
}
int t=0;
for(int i=1; i<=D; i++) t+=S[i][R];
if(L==1) S[D+1][R] = tmp - t;
else S[D+1][L-1] = S[D+1][N] - (tmp - t);
//printf("%d %d",D+1,R);
/*if(R-1<(N+1)/2){
t=0;
for(int i=1; i<=R-1 ;i++) t+=S[D+1][i];
printf("%d",S[D+1][2]);
S[D+1][R-1] = S[D+1][R]-t;
printf("%d %d\n",D+1,R-1);
}*/
}
//for(int i=1; i<=5; i++) printf("%d",S[3][i]);
for(int x=1; x<=N; x++)
for(int y=1; y<=N; y++){
if(S[y][x]!=S[y][x-1]){
Report(y,x);
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |