# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
341937 | 2020-12-31T15:35:44 Z | Hazem | Kocka (COCI18_kocka) | C++14 | 58 ms | 5868 KB |
/* ID: tmhazem1 LANG: C++14 TASK: pprime */ #include <bits/stdc++.h> using namespace std; #define S second #define F first #define LL long long const int N = 2e5 + 10; LL LINF = 100000000000000000; LL INF = 1000000000; int MOD = 1e9+7; vector<pair<int,int>>vec; int col[N][2],row[N][2]; int colval[N][2],rowval[N][2]; int main() { // freopen("out.txt","w",stdout); int n; scanf("%d",&n); for(int i=1;i<=n*2;i++) scanf("%d",&row[i%n?i%n:n][(i-1)/n]); for(int i=1;i<=2*n;i++) scanf("%d",&col[i%n?i%n:n][(i-1)/n]); for(int i=1;i<=n;i++) rowval[i][0] = colval[i][0] = n+1,rowval[i][1] = colval[i][1] = 0; for(int i=1;i<=n;i++){ row[i][1] = n - row[i][1]-1; for(int j=0;j<2;j++){ if(row[i][j]==-1||row[i][j]==n)continue; rowval[i][0] = min(rowval[i][0],row[i][j]+1); rowval[i][1] = max(rowval[i][1],row[i][j]+1); colval[row[i][j]+1][0] = min(colval[row[i][j]+1][0],i); colval[row[i][j]+1][1] = max(colval[row[i][j]+1][1],i); } } for(int i=1;i<=n;i++){ col[i][1] = n-col[i][1]-1; for(int j=0;j<2;j++){ if(col[i][j]==-1||col[i][j]==n)continue; colval[i][0] = min(colval[i][0],col[i][j]+1); colval[i][1] = max(colval[i][1],col[i][j]+1); rowval[col[i][j]+1][0] = min(rowval[col[i][j]+1][0],i); rowval[col[i][j]+1][1] = max(rowval[col[i][j]+1][1],i); } } bool q = 1; for(int i=1;i<=n;i++){ if(rowval[i][0]==n+1)rowval[i][0] = 0; if(rowval[i][1]==0)rowval[i][1] = n+1; if(colval[i][0]==n+1)colval[i][0] = 0; if(colval[i][1]==0)colval[i][1] = n+1; for(int j=0;j<2;j++){ q &= rowval[i][j] == row[i][j]+1,q &= colval[i][j]==col[i][j]+1; } } puts(q?"DA":"NE"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 54 ms | 5356 KB | Output is correct |
2 | Correct | 54 ms | 5740 KB | Output is correct |
3 | Correct | 54 ms | 5740 KB | Output is correct |
4 | Correct | 44 ms | 4716 KB | Output is correct |
5 | Correct | 54 ms | 5868 KB | Output is correct |
6 | Correct | 56 ms | 5740 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 55 ms | 5484 KB | Output is correct |
2 | Correct | 44 ms | 4716 KB | Output is correct |
3 | Correct | 54 ms | 5776 KB | Output is correct |
4 | Correct | 49 ms | 4716 KB | Output is correct |
5 | Correct | 58 ms | 5740 KB | Output is correct |
6 | Correct | 56 ms | 5484 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 56 ms | 5356 KB | Output is correct |
2 | Correct | 43 ms | 4588 KB | Output is correct |
3 | Correct | 54 ms | 5740 KB | Output is correct |
4 | Correct | 55 ms | 5740 KB | Output is correct |
5 | Correct | 54 ms | 5756 KB | Output is correct |
6 | Correct | 45 ms | 4632 KB | Output is correct |