Submission #1462474


Source Code Expand

Copy
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

#define REP(i,x) for(int i=0 ; i<(int)(x) ; i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> from(N);
    vector<int> to(N);
    REP(i, M){
        int a, b;
        cin >> a >> b;
        a--;b--;
        if(a==0)from[b] = 1;
        if(b==N-1)to[a] = 1;
    }
    bool res = false;
    REP(i, N)if(from[i] && to[i])res = true;
    cout << (res ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    return 0;
}

Submission Info

Submission Time
Task C - Cat Snuke and a Voyage
User nel215
Language C++14 (GCC 5.4.1)
Score 300
Code Size 824 Byte
Status AC
Exec Time 117 ms
Memory 1920 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 11
Set Name Test Cases
Sample example0, example1, example2, example3
All example0, example1, example2, example3, last0, last1, many0, many1, rand0, rand1, rand2
Case Name Status Exec Time Memory
example0 AC 1 ms 256 KB
example1 AC 1 ms 256 KB
example2 AC 2 ms 1024 KB
example3 AC 1 ms 256 KB
last0 AC 117 ms 1920 KB
last1 AC 117 ms 1792 KB
many0 AC 108 ms 1792 KB
many1 AC 108 ms 1792 KB
rand0 AC 76 ms 1664 KB
rand1 AC 115 ms 1664 KB
rand2 AC 68 ms 1664 KB