Submission #1463631


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define PI acos(-1.0)

typedef long long ll;
const int maxn=2e5+5;

int vis1[maxn],vis2[maxn];

int main()
{
    int n,m;
    cin >> n >> m;
    int cnt=0;
    int flag=1;
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin >> a >> b;
        if(a==1)
            vis1[b]=1;
        if(b==1)
            vis1[a]=1;
        if(a==n)
            vis2[b]=1;
        if(b==n)
            vis2[a]=1;
    }
    for(int i=1;i<=n;i++)
        if(vis1[i]&&vis2[i])
        {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}

Submission Info

Submission Time
Task C - Cat Snuke and a Voyage
User unbelievable
Language C++14 (GCC 5.4.1)
Score 300
Code Size 703 Byte
Status AC
Exec Time 152 ms
Memory 1792 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 1 ms 256 KB
example3 AC 1 ms 256 KB
last0 AC 152 ms 256 KB
last1 AC 149 ms 256 KB
many0 AC 142 ms 1792 KB
many1 AC 138 ms 1792 KB
rand0 AC 99 ms 256 KB
rand1 AC 146 ms 256 KB
rand2 AC 87 ms 256 KB