Submission #1462064


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;

int main()
{
  int N, M;
  cin >> N >> M;
  int latte[200000] = {}, malta[200000] = {};
  for(int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    if(a == 0) latte[b] = true;
    if(b == N - 1) malta[a] = true;
  }
  for(int i = 0; i < N; i++) {
    if(latte[i] && malta[i]) {
      cout << "POSSIBLE" << endl;
      return (0);
    }
  }
  cout << "IMPOSSIBLE" << endl;
}

Submission Info

Submission Time
Task C - Cat Snuke and a Voyage
User ei13333
Language C++14 (GCC 5.4.1)
Score 300
Code Size 466 Byte
Status
Exec Time 152 ms
Memory 1792 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 example0, example1, example2, example3
All 300 / 300 example0, example1, example2, example3, last0, last1, many0, many1, rand0, rand1, rand2
Case Name Status Exec Time Memory
example0 2 ms 1792 KB
example1 2 ms 1792 KB
example2 2 ms 1792 KB
example3 2 ms 1792 KB
last0 152 ms 1792 KB
last1 149 ms 1792 KB
many0 140 ms 1792 KB
many1 138 ms 1792 KB
rand0 99 ms 1792 KB
rand1 147 ms 1792 KB
rand2 88 ms 1792 KB