Submission #7081607


Source Code Expand

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<vector<int>> G(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  for (int v1 : G[0]) {
    for (int v2 : G[v1]) {
      if (v2 == N - 1) {
        cout << "POSSIBLE" << '\n';
        return 0;
      }
    }
  }
  cout << "IMPOSSIBLE" << '\n';
  return 0;
}

Submission Info

Submission Time
Task C - Cat Snuke and a Voyage
User kyo1
Language C++14 (GCC 5.4.1)
Score 300
Code Size 520 Byte
Status
Exec Time 74 ms
Memory 12016 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 1 ms 256 KB
example1 1 ms 256 KB
example2 2 ms 2560 KB
example3 1 ms 256 KB
last0 74 ms 10496 KB
last1 74 ms 10496 KB
many0 56 ms 12016 KB
many1 57 ms 12016 KB
rand0 46 ms 8832 KB
rand1 69 ms 9856 KB
rand2 43 ms 8576 KB