답안 #778215

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
778215 2023-07-10T07:30:05 Z vjudge1 Kocka (COCI18_kocka) C++17
70 / 70
34 ms 5340 KB
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define ll long long
#define pb push_back
#define N 100001
#define f first
#define s second
int main(){
	lalala;
	int n;cin>>n;
	int arr[n][4],yan[n][2],sutun[n];
	int yes=0;
	memset(yan,-1,sizeof(yan));
	memset(sutun,0,sizeof(sutun));
	for(int uwu=0;uwu<4;uwu++){
		for(int i=0;i<n;i++){
			cin>>arr[i][uwu];
			if(arr[i][uwu]==-1)continue;
			if(uwu==0){
				yan[i][0]=arr[i][uwu];
				sutun[arr[i][uwu]]=1;
			}
			if(uwu==1){
				yan[i][1]=n-arr[i][uwu]-1;
				sutun[n-arr[i][uwu]-1]=1;
			}
		}
	}
	for(int i=0;i<n;i++){
		if(arr[i][0]+arr[i][1]>n-1){
			yes=1;break;
		}
		if(arr[i][2]+arr[i][3]>n-1){
			yes=1;break;
		}
	}
	if(yes){
		cout<<"NE"<<endl;return 0;
	}


	/*for(int i=0;i<n;i++){
	cout<<yan[i][0]<<" "<<yan[i][1]<<endl;
	}cout<<endl;
	for(int i=0;i<n;i++)cout<<sutun[i]<<" ";
	cout<<endl;*/ 

	for(int i=0;i<n;i++){
		int yer=arr[i][2];
		//cout<<yer<<" "<<i<<endl;
		if(yer==-1){
			if(sutun[i]){yes=1;break;}
			continue;
		}

		if(yan[yer][0]<=i&&i<=yan[yer][1])continue;
		yes=1;break;
	}
	for(int i=0;i<n;i++){
		int yer=arr[i][3];
		if(yer==-1){
			if(sutun[i]){yes=1;break;}
			continue;
		}
		//cout<<yer<<" "<<i;
		yer=n-yer-1;
		if(yan[yer][0]<=i&&i<=yan[yer][1])continue;
		yes=1;break;
	}
	if(yes)cout<<"NE"<<endl;
	else cout<<"DA"<<endl;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 4824 KB Output is correct
2 Correct 25 ms 5324 KB Output is correct
3 Correct 30 ms 5324 KB Output is correct
4 Correct 20 ms 4192 KB Output is correct
5 Correct 26 ms 5324 KB Output is correct
6 Correct 34 ms 5340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 5092 KB Output is correct
2 Correct 19 ms 4184 KB Output is correct
3 Correct 24 ms 5336 KB Output is correct
4 Correct 21 ms 4312 KB Output is correct
5 Correct 33 ms 5324 KB Output is correct
6 Correct 33 ms 5064 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 4820 KB Output is correct
2 Correct 19 ms 4192 KB Output is correct
3 Correct 25 ms 5320 KB Output is correct
4 Correct 25 ms 5340 KB Output is correct
5 Correct 25 ms 5316 KB Output is correct
6 Correct 18 ms 4176 KB Output is correct