Submission #86098

# Submission time Handle Problem Language Result Execution time Memory
86098 2018-11-24T21:40:19 Z ffrich Kocka (COCI18_kocka) C++11
70 / 70
166 ms 2208 KB
#include <iostream>

using namespace std;

int a[100001],b[100001],c[100001],d[100001];

int main (){
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	for(int i=0;i<n;i++){
		cin >> b[i];
	}
	for(int i=0;i<n;i++){
		cin >> c[i];
	}
	for(int i=0;i<n;i++){
		cin >> d[i];
	}
	int t=1;
	for(int i=0;i<n;i++){
		if(a[i]==-1 and b[i]==-1 or a[i]<=(n-b[i]-1) and c[a[i]]<=i and d[a[i]]<=(n-i-1) and c[a[i]]!=-1 and d[a[i]]!=-1 and a[i]!=-1 and b[i]!=-1){
			continue;
		}
		else{
			t=0;
			break;
		}
	}
	if(t==0){
		cout << "NE";
		return 0;
	}
	for(int i=0;i<n;i++){
		if(c[i]==-1 and d[i]==-1 or c[i]<=(n-d[i]-1) and a[c[i]]<=i and b[c[i]]<=(n-i-1) and a[c[i]]!=-1 and a[c[i]]!=-1 and c[i]!=-1 and d[i]!=-1){
			continue;
		}
		else{
			t=0;
			break;
		}
	}
	if(t==0){
		cout << "NE";
		return 0;
	}
	if(t==1){
		cout << "DA";
	}


return 0;
}

Compilation message

kocka.cpp: In function 'int main()':
kocka.cpp:24:15: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if(a[i]==-1 and b[i]==-1 or a[i]<=(n-b[i]-1) and c[a[i]]<=i and d[a[i]]<=(n-i-1) and c[a[i]]!=-1 and d[a[i]]!=-1 and a[i]!=-1 and b[i]!=-1){
      ~~~~~~~~~^~~~~~~~~~~~
kocka.cpp:37:15: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if(c[i]==-1 and d[i]==-1 or c[i]<=(n-d[i]-1) and a[c[i]]<=i and b[c[i]]<=(n-i-1) and a[c[i]]!=-1 and a[c[i]]!=-1 and c[i]!=-1 and d[i]!=-1){
      ~~~~~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 4 ms 452 KB Output is correct
4 Correct 3 ms 524 KB Output is correct
5 Correct 3 ms 756 KB Output is correct
6 Correct 3 ms 756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 756 KB Output is correct
2 Correct 3 ms 756 KB Output is correct
3 Correct 3 ms 756 KB Output is correct
4 Correct 3 ms 756 KB Output is correct
5 Correct 3 ms 756 KB Output is correct
6 Correct 3 ms 756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 123 ms 2188 KB Output is correct
2 Correct 135 ms 2188 KB Output is correct
3 Correct 135 ms 2208 KB Output is correct
4 Correct 87 ms 2208 KB Output is correct
5 Correct 166 ms 2208 KB Output is correct
6 Correct 149 ms 2208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 127 ms 2208 KB Output is correct
2 Correct 94 ms 2208 KB Output is correct
3 Correct 153 ms 2208 KB Output is correct
4 Correct 96 ms 2208 KB Output is correct
5 Correct 138 ms 2208 KB Output is correct
6 Correct 125 ms 2208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 134 ms 2208 KB Output is correct
2 Correct 89 ms 2208 KB Output is correct
3 Correct 158 ms 2208 KB Output is correct
4 Correct 133 ms 2208 KB Output is correct
5 Correct 135 ms 2208 KB Output is correct
6 Correct 95 ms 2208 KB Output is correct