Submission #86098

#TimeUsernameProblemLanguageResultExecution timeMemory
86098ffrichKocka (COCI18_kocka)C++11
70 / 70
166 ms2208 KiB
#include <iostream> using namespace std; int a[100001],b[100001],c[100001],d[100001]; int main (){ int n; cin >> n; for(int i=0;i<n;i++){ cin >> a[i]; } for(int i=0;i<n;i++){ cin >> b[i]; } for(int i=0;i<n;i++){ cin >> c[i]; } for(int i=0;i<n;i++){ cin >> d[i]; } int t=1; for(int i=0;i<n;i++){ if(a[i]==-1 and b[i]==-1 or a[i]<=(n-b[i]-1) and c[a[i]]<=i and d[a[i]]<=(n-i-1) and c[a[i]]!=-1 and d[a[i]]!=-1 and a[i]!=-1 and b[i]!=-1){ continue; } else{ t=0; break; } } if(t==0){ cout << "NE"; return 0; } for(int i=0;i<n;i++){ if(c[i]==-1 and d[i]==-1 or c[i]<=(n-d[i]-1) and a[c[i]]<=i and b[c[i]]<=(n-i-1) and a[c[i]]!=-1 and a[c[i]]!=-1 and c[i]!=-1 and d[i]!=-1){ continue; } else{ t=0; break; } } if(t==0){ cout << "NE"; return 0; } if(t==1){ cout << "DA"; } return 0; }

Compilation message (stderr)

kocka.cpp: In function 'int main()':
kocka.cpp:24:15: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if(a[i]==-1 and b[i]==-1 or a[i]<=(n-b[i]-1) and c[a[i]]<=i and d[a[i]]<=(n-i-1) and c[a[i]]!=-1 and d[a[i]]!=-1 and a[i]!=-1 and b[i]!=-1){
      ~~~~~~~~~^~~~~~~~~~~~
kocka.cpp:37:15: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if(c[i]==-1 and d[i]==-1 or c[i]<=(n-d[i]-1) and a[c[i]]<=i and b[c[i]]<=(n-i-1) and a[c[i]]!=-1 and a[c[i]]!=-1 and c[i]!=-1 and d[i]!=-1){
      ~~~~~~~~~^~~~~~~~~~~~
#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...