Submission #2551582


Source Code Expand

#include <bits/stdc++.h>
#define rep(i,j,k) for(ll i=(ll)j;i<(ll)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF INT_MAX
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    vec<P> v(n);
    rep(i,0,n)v[i].fi=v[i].se=0;
    rep(i,0,m){
        int a,b;
        cin>>a>>b;
        if(a==1)v[b-1].fi++;
        if(b==n)v[a-1].se++;
    }
    
    rep(i,0,m){
        if(v[i].fi&&v[i].se){
            cout<<"POSSIBLE"<<endl;
            return 0;
        }
    }
    cout<<"IMPOSSIBLE"<<endl;
    return 0;
}

Submission Info

Submission Time
Task C - Cat Snuke and a Voyage
User gotutiyan
Language C++14 (GCC 5.4.1)
Score 0
Code Size 941 Byte
Status WA
Exec Time 117 ms
Memory 1792 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 4
AC × 10
WA × 1
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 1792 KB
last1 AC 117 ms 1792 KB
many0 AC 108 ms 1792 KB
many1 AC 108 ms 1792 KB
rand0 AC 77 ms 1664 KB
rand1 WA 115 ms 1664 KB
rand2 AC 68 ms 1664 KB