답안 #560992

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
560992 2022-05-12T07:17:35 Z AGE Kocka (COCI18_kocka) C++14
28 / 70
3 ms 468 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][1005];
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;

    }

    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;

    }

    for(int i=1;i<=n;i++){

        int x;
        cin>>x;

        if(x==-1)
            x=n+1;

        for(int j=1;j<=x;j++){

            if(j==n+1)
                continue;

            if(ans[0][j]==i||ans[1][j]==i)
                ok=1;
        }

        ans[2][i]=x;

    }

    for(int i=1;i<=n;i++){

        int x;
        cin>>x;

        if(x==-1)
            x=n+1;

        for(int j=n;j>n-x;j--){

            if(j<=0)
                continue;

            if(ans[0][j]==i||ans[1][j]==i)
                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


*/

Compilation message

kocka.cpp:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   19 | main()
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 3 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -