Submission #341937

#TimeUsernameProblemLanguageResultExecution timeMemory
341937HazemKocka (COCI18_kocka)C++14
70 / 70
58 ms5868 KiB
/* 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 (stderr)

kocka.cpp: In function 'int main()':
kocka.cpp:30:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   30 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
kocka.cpp:33:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   33 |         scanf("%d",&row[i%n?i%n:n][(i-1)/n]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kocka.cpp:36:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   36 |         scanf("%d",&col[i%n?i%n:n][(i-1)/n]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...