답안 #234656

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
234656 2020-05-25T03:36:17 Z super_j6 Kocka (COCI18_kocka) C++14
70 / 70
55 ms 2680 KB
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string.h>
using namespace std;
#define endl '\n'
#define ll long long
#define pi pair<int, int>
#define f first
#define s second

const int maxn = 100000;
int n;
int a[4][maxn];
int s[maxn];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	
	for(int t = 0; t < 4; t++)
	for(int i = 0; i < n; i++){
	    cin >> a[t][i];
	}
	
	for(int tt = 0; tt < 4; tt++){
	    if(tt < 2) for(int i = 0; i < n; i++){
	        if(a[0][i] + a[1][i] >= n || !~a[0][i] ^ !~a[1][i]){
	            cout << "NE" << endl;
	            return 0;
	        }
	    }
	    for(int t = 0; t < 2; t++){
	        memset(s, 0x3f, sizeof(s));
	        for(int i = n - 1; ~i; i--){
	            if(~a[2][i]) s[a[2][i]] = i;
	        }
	        for(int i = 0; i < n; i++){
	            if(s[i] < a[0][i]){
	                cout << "NE" << endl;
	                return 0;
	            }
	        }
	        swap(a[2], a[3]);
	        reverse(a[0], a[0] + n);
	    }
	    swap(a[0], a[2]);
	    swap(a[2], a[1]);
	    swap(a[1], a[3]);
	    reverse(a[0], a[0] + n);
	    reverse(a[1], a[1] + n);
	}
	
	cout << "DA" << endl;

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 8 ms 2304 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 8 ms 2304 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 8 ms 2304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 8 ms 2304 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 8 ms 2304 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 8 ms 2304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 2552 KB Output is correct
2 Correct 49 ms 2168 KB Output is correct
3 Correct 49 ms 2040 KB Output is correct
4 Correct 36 ms 2424 KB Output is correct
5 Correct 48 ms 2040 KB Output is correct
6 Correct 49 ms 2044 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 2680 KB Output is correct
2 Correct 34 ms 2552 KB Output is correct
3 Correct 48 ms 2172 KB Output is correct
4 Correct 41 ms 2424 KB Output is correct
5 Correct 49 ms 2040 KB Output is correct
6 Correct 50 ms 2432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 53 ms 2556 KB Output is correct
2 Correct 36 ms 2552 KB Output is correct
3 Correct 50 ms 2112 KB Output is correct
4 Correct 50 ms 2040 KB Output is correct
5 Correct 50 ms 2072 KB Output is correct
6 Correct 36 ms 2424 KB Output is correct