Submission #701721

# Submission time Handle Problem Language Result Execution time Memory
701721 2023-02-22T02:34:12 Z chenyan Kocka (COCI18_kocka) C++17
70 / 70
93 ms 24028 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb emplace_back
#define N 200010
vector<pii>v;
int a[4][N];
set<int>s[N];
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m,i,j,k;
	cin>>n;
	for(j=0;j<4;j++)for(i=0;i<n;i++)cin>>a[j][i];
	for(i=0;i<n;i++){
		for(j=0;j<3;j+=2){
			if((a[j][i]==-1||a[j+1][i]==-1)&&a[j][i]!=a[j+1][i]){
				cout<<"NE\n";
				return 0;
			}
			if(a[j][i]>n-1-a[j+1][i]){
				cout<<"NE\n";
				return 0;
			}
		}
		if(a[2][i]!=-1)s[a[2][i]].insert(i);
		if(a[3][i]!=-1)s[n-1-a[3][i]].insert(i);
	}
	for(i=0;i<n;i++){
		if(a[0][i]==-1||s[i].empty())continue;
		if(s[i].lower_bound(a[0][i])!=s[i].begin()||s[i].upper_bound(n-1-a[1][i])!=s[i].end()){
			cout<<"NE\n";
			return 0;
		}
	}
	cout<<"DA\n";
}

Compilation message

kocka.cpp: In function 'int main()':
kocka.cpp:16:8: warning: unused variable 'm' [-Wunused-variable]
   16 |  int n,m,i,j,k;
      |        ^
kocka.cpp:16:14: warning: unused variable 'k' [-Wunused-variable]
   16 |  int n,m,i,j,k;
      |              ^
# Verdict Execution time Memory Grader output
1 Correct 5 ms 9684 KB Output is correct
2 Correct 5 ms 9748 KB Output is correct
3 Correct 5 ms 9684 KB Output is correct
4 Correct 5 ms 9684 KB Output is correct
5 Correct 6 ms 9684 KB Output is correct
6 Correct 5 ms 9684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 9684 KB Output is correct
2 Correct 5 ms 9864 KB Output is correct
3 Correct 6 ms 9780 KB Output is correct
4 Correct 5 ms 9860 KB Output is correct
5 Correct 5 ms 9684 KB Output is correct
6 Correct 5 ms 9732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 17380 KB Output is correct
2 Correct 33 ms 14612 KB Output is correct
3 Correct 33 ms 14704 KB Output is correct
4 Correct 25 ms 14016 KB Output is correct
5 Correct 32 ms 14540 KB Output is correct
6 Correct 33 ms 14544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 83 ms 22516 KB Output is correct
2 Correct 25 ms 13992 KB Output is correct
3 Correct 34 ms 14632 KB Output is correct
4 Correct 93 ms 23512 KB Output is correct
5 Correct 33 ms 14540 KB Output is correct
6 Correct 85 ms 24028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 17380 KB Output is correct
2 Correct 25 ms 14036 KB Output is correct
3 Correct 33 ms 14580 KB Output is correct
4 Correct 36 ms 14692 KB Output is correct
5 Correct 32 ms 14588 KB Output is correct
6 Correct 25 ms 13996 KB Output is correct