Submission #86829

#TimeUsernameProblemLanguageResultExecution timeMemory
86829mayhoubsalehKocka (COCI18_kocka)C++14
14 / 70
153 ms2984 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back using namespace std; int n,a[4][100005]; pair<int,int> b[100005]; int main() { cin>>n; for(int i=0;i<4;i++){ for(int j=0;j<n;j++){ cin>>a[i][j]; } } for(int i=0;i<n;i++){ b[i].first=1e9; b[i].second=-1; } for(int i=0;i<n;i++){ if(a[0][i]==-1&&a[1][i]!=-1){cout<<"NE"<<endl;return 0;} if(a[1][i]==-1&&a[0][i]!=-1){cout<<"NE"<<endl;return 0;} if(a[0][i]+a[1][i]>=n){cout<<"NE"<<endl;return 0;} b[a[0][i]].first=min(b[a[0][i]].first,i); b[a[0][i]].second=max(b[a[0][i]].second,i); b[n-a[1][i]-1].first=min(b[n-1-a[1][i]].first,i); b[n-1-a[1][i]].second=max(b[n-1-a[1][i]].second,i); } for(int i=0;i<n;i++){ if(a[2][i]==-1&&a[3][i]!=-1){cout<<"NE"<<endl;return 0;} if(a[3][i]==-1&&a[2][i]!=-1){cout<<"NE"<<endl;return 0;} if(a[2][i]+a[3][i]>=n){cout<<"NE"<<endl;return 0;} if(b[i].first!=1e9){ if(a[2][i]!=b[i].first){cout<<"NE"<<endl;return 0;} if(n-a[3][i]-1!=b[i].second){cout<<"NE"<<endl;return 0;} } } cout<<"DA"<<endl; return 0; }
#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...