제출 #166935

#제출 시각아이디문제언어결과실행 시간메모리
166935muhi1112Kocka (COCI18_kocka)C++17
0 / 70
45 ms4008 KiB
#include <bits/stdc++.h> using namespace std; #define f0 first #define s2 second #define mp make_pair #define pb push_back #define ll long long #define fri(a) freopen(a,"r",stdin); #define fro(a) freopen(a,"w",stdout); const int N=1e5+5; int n,left1[N],right1[N],top[N],bottom[N]; int main(){ //fri("in.txt"); //fro("out.txt"); ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0); cin>>n; for(int i=0;i<n;i++){ cin>>left1[i]; } for(int i=0;i<n;i++){ cin>>right1[i]; } for(int i=0;i<n;i++){ cin>>top[i]; } for(int i=0;i<n;i++){ cin>>bottom[i]; } for(int i=0;i<n;i++){ if(left1[i]==-1){ if(right1[i]!=-1 || top[0]==i || bottom[0]==n-i-1){ cout<<"NE"<<endl; return 0; } } if(left1[i]>=0){ if(top[left1[i]]>i || bottom[left1[i]]>i || right1[i]+left1[i]>=n){ cout<<"NE"<<endl; return 0; } } if(right1[i]==-1){ if(left1[i]!=-1 || top[n-1]==i || bottom[n-1]==n-i-1){ cout<<"NE"<<endl; return 0; } } if(right1[i]>=0){ if(top[n-right1[i]-1]>i || bottom[n-right1[i]-1]>i || right1[i]+left1[i]>=n){ cout<<"NE"<<endl; return 0; } } if(top[i]==-1){ if(bottom[i]!=-1 || left1[0]==i || right1[0]==i){ cout<<"NE"<<endl; return 0; } } if(top[i]>=0){ if(top[i]+bottom[i]>=n || left1[top[i]]>i || right1[top[i]]>n-i-1){ cout<<"NE"<<endl; return 0; } } if(bottom[i]==-1){ if(top[i]!=-1 || left1[n-1]==i || right1[n-1]==i){ cout<<"NE"<<endl; return 0; } } if(bottom[i]>=0){ if(top[i]+bottom[i]>=n || left1[n-bottom[i]-1]>i || right1[n-bottom[i]-1]>n-i-1){ //cout<<i<<" "<<left1[n-bottom[i]-1]<<" "<<right1[n-bottom[i]-1]; 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...