Submission #1462318


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;

vector <int> l;
bool posible[200010];

int main()
{
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    int n, m, a, b;
    cin >> n >> m;

    while (m--) {
        cin >> a >> b;
        if (a > b)
            swap(a, b);
        if (b == n)
            posible[a] = 1;
        if (a == 1)
            l.push_back(b);
    }

    for (auto i : l) {
        if (posible[i]) {
            cout << "POSSIBLE";
            return 0;
        }
    }

    cout << "IMPOSSIBLE";

    return 0;
}

Submission Info

Submission Time
Task C - Cat Snuke and a Voyage
User theodormoroianu
Language C++14 (GCC 5.4.1)
Score 300
Code Size 577 Byte
Status AC
Exec Time 34 ms
Memory 1148 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 34 ms 256 KB
last1 AC 34 ms 256 KB
many0 AC 33 ms 1148 KB
many1 AC 33 ms 1148 KB
rand0 AC 22 ms 256 KB
rand1 AC 33 ms 256 KB
rand2 AC 20 ms 256 KB