# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
561029 | AGE | Kocka (COCI18_kocka) | C++14 | 172 ms | 16712 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define int long long
using namespace std;
const int N=1e5+5,M=2e3+10,mod=100000000000031;
vector<int>v;
long long summ(long long x,long long y){
return ((x%mod)+(y%mod))%mod;
}
long long mult(long long x,long long y){
return ((x%mod)*(y%mod))%mod;
}
int ans[4][N];
set<int>st[N];
main()
{
int n;
cin>>n;
int ok=0;
for(int i=1;i<=n;i++){
int x;
cin>>x;
if(x==-1)
x=n+1;
ans[0][i]=x+1;
st[x+1].insert(i);
}
for(int i=1;i<=n;i++){
int x;
cin>>x;
if(x==-1)
x=n+1;
if(n-x!=-1&&n-x<ans[0][i])
ok=1;
ans[1][i]=n-x;
if(n-x==-1)
continue;
st[n-x].insert(i);
}
for(int i=1;i<=n;i++){
int x;
cin>>x;
if(x==-1)
x=n+1;
if(*st[i].begin()<=x)
ok=1;
ans[2][i]=x;
}
for(int i=1;i<=n;i++){
int x;
cin>>x;
if(x==-1)
x=n+1;
if(*st[i].begin()>n-x)
ok=1;
}
if(ok==1)
cout<<"NE"<<endl;
else cout<<"DA"<<endl;
return 0;
}
/*
3
-1 0 1
-1 2 1
-1 2 -1
1 0 -1
3
-1 2 0
-1 0 1
2 2 1
0 0 1
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |