답안 #561034

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
561034 2022-05-12T07:56:58 Z AGE Kocka (COCI18_kocka) C++14
70 / 70
215 ms 19152 KB
#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].size()==0)
            continue;

        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].size()==0)
            continue;

        if(*st[i].rbegin()>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

kocka.cpp:20:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   20 | main()
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 5076 KB Output is correct
2 Correct 4 ms 5076 KB Output is correct
3 Correct 4 ms 5076 KB Output is correct
4 Correct 3 ms 5012 KB Output is correct
5 Correct 3 ms 5148 KB Output is correct
6 Correct 4 ms 5020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5072 KB Output is correct
2 Correct 4 ms 5124 KB Output is correct
3 Correct 4 ms 5196 KB Output is correct
4 Correct 4 ms 5076 KB Output is correct
5 Correct 4 ms 5076 KB Output is correct
6 Correct 4 ms 5008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 150 ms 13260 KB Output is correct
2 Correct 215 ms 19152 KB Output is correct
3 Correct 194 ms 19064 KB Output is correct
4 Correct 87 ms 12736 KB Output is correct
5 Correct 195 ms 19004 KB Output is correct
6 Correct 190 ms 19072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 173 ms 16652 KB Output is correct
2 Correct 89 ms 13124 KB Output is correct
3 Correct 188 ms 18936 KB Output is correct
4 Correct 128 ms 17236 KB Output is correct
5 Correct 186 ms 18940 KB Output is correct
6 Correct 162 ms 18764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 141 ms 13156 KB Output is correct
2 Correct 100 ms 12420 KB Output is correct
3 Correct 198 ms 19016 KB Output is correct
4 Correct 200 ms 18972 KB Output is correct
5 Correct 204 ms 19008 KB Output is correct
6 Correct 96 ms 13096 KB Output is correct