Submission #1462430


Source Code Expand

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \     | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/







int N, M;
set<pair<int, int>> E;
//---------------------------------------------------------------------------------------------------
string solve() {
    rep(i, 1, N - 1) {
        if (E.count({ 0,i }) && E.count({ i, N - 1 })) return "POSSIBLE";
    }
    return "IMPOSSIBLE";
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> M;
    rep(i, 0, M) {
        int a, b; cin >> a >> b;
        a--; b--;
        E.insert({ a,b });
        E.insert({ b,a });
    }

    cout << solve() << endl;
}

Submission Info

Submission Time
Task C - Cat Snuke and a Voyage
User hamayanhamayan
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1554 Byte
Status AC
Exec Time 226 ms
Memory 19072 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 256 KB
example3 AC 1 ms 256 KB
last0 AC 213 ms 19072 KB
last1 AC 226 ms 19072 KB
many0 AC 216 ms 19072 KB
many1 AC 198 ms 19072 KB
rand0 AC 126 ms 12416 KB
rand1 AC 207 ms 18816 KB
rand2 AC 108 ms 11008 KB