답안 #576436

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
576436 2022-06-13T06:06:22 Z AGE Checker (COCI19_checker) C++14
0 / 110
6 ms 212 KB
#include <bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back

using namespace std;
const int N=1e6,M=3e3+2,mod=1e9+7;

main()
{

    int n;
    cin>>n;

    string s;
    cin>>s;

    map< pair<int, int> , int > mp;

    for(int i=0;i<n-3;i++){

        int x,y,z;
        cin>>x>>y>>z;

        mp[{x,y}]=1;
        mp[{y,x}]=1;

    }

    int ok1=0,ok2=0;

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

        if(i+2>n)
            continue;

        if(mp[{i,i+2}]!=1)
            ok1=1;

    }

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

        if(i+2>n)
            continue;

        if(mp[{i,i+2}]!=1)
            ok2=1;

    }

    if(n%2==0&&ok2==0)
        cout<<"tocno"<<endl;
        
    else if(n%2!=0&&ok1==0)
        cout<<"tocno"<<endl;

    else if(n%2!=0&&ok2==0&&mp[{n-1,2}]==1)
        cout<<"tocno"<<endl;
    
    else if(n%2==0&&ok1==0&&mp[{1,n-1}]==1)
        cout<<"tocno"<<endl;
    else
        cout<<"neispravna triangulacija"<<endl;
        




    return 0;

}

/*
7
1223121
1 3 3
3 5 1
5 7 3
7 3 2

*/

Compilation message

checker.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main()
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -