답안 #170329

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
170329 2019-12-24T20:05:45 Z ngmh Kocka (COCI18_kocka) C++11
70 / 70
211 ms 5880 KB
#include <bits/stdc++.h>
using namespace std;

long long s, a[5][100000];

void fail(){
	cout << "NE";
	exit(0);
}

int main(){
	cin >> s;
	if(s == 3) fail();
	for(int i = 0; i < 4; i++){
		for(int j = 0; j < s; j++) cin >> a[i][j];
	}
	for(int i = 0; i < s; i++){
		if(a[0][i] == -1 && a[1][i] != -1) fail();
		if(a[1][i] == -1 && a[0][i] != -1) fail();
		if(a[0][i] == 0 && a[1][i] == 0) continue;
		if(a[0][i] == s-1 && a[1][i] != 0) fail();
		if(a[1][i] == s-1 && a[0][i] != 0) fail();
	}
	for(int i = 0; i < s; i++){
		if(a[2][i] == -1 && a[3][i] != -1) fail();
		if(a[3][i] == -1 && a[3][i] != -1) fail();
		if(a[2][i] == -1 && a[3][i] == 0) continue;
		if(a[2][i] == s-1 && a[3][i] != 0) fail();
		if(a[3][i] == s-1 && a[2][i] != 0) fail();
	}
	cout <<  "DA";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 380 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 4 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 380 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 174 ms 5304 KB Output is correct
2 Correct 199 ms 5764 KB Output is correct
3 Correct 198 ms 5780 KB Output is correct
4 Correct 125 ms 4600 KB Output is correct
5 Correct 198 ms 5752 KB Output is correct
6 Correct 200 ms 5880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 184 ms 5624 KB Output is correct
2 Correct 130 ms 4704 KB Output is correct
3 Correct 211 ms 5752 KB Output is correct
4 Correct 134 ms 4728 KB Output is correct
5 Correct 197 ms 5752 KB Output is correct
6 Correct 184 ms 5616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 173 ms 5368 KB Output is correct
2 Correct 126 ms 4608 KB Output is correct
3 Correct 198 ms 5852 KB Output is correct
4 Correct 198 ms 5752 KB Output is correct
5 Correct 199 ms 5880 KB Output is correct
6 Correct 127 ms 4620 KB Output is correct