Submission #5818574


Source Code Expand

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

int main() {
  int n,m,ans;
  cin >> n >> m;
  ans = 0;
  vector<int> a(m);
  vector<int> b(m);
  for(int i=0;i<m;i++){
    cin >> a.at(i) >> b.at(i);
  }
  
  for(int i=0;i<m;i++){
    if(ans >0){
      break;
    }
    else if(a.at(i) == 1){
      for(int j=0;j<m;j++){
        if(a.at(j) == b.at(i) && b.at(j) == n){
          ans++;
          break;
        }
      }
    }
  }
  
  if(ans>0){
    cout << "POSSIBLE" << endl;
  }
  else {
    cout << "IMPOSSIBLE" << endl;
  }
}

Submission Info

Submission Time
Task C - Cat Snuke and a Voyage
User touchico
Language C++14 (GCC 5.4.1)
Score 0
Code Size 564 Byte
Status

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 example0, example1, example2, example3
All 0 / 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 1 ms 256 KB
example3 1 ms 256 KB
last0 138 ms 1792 KB
last1 118 ms 1792 KB
many0
many1
rand0 77 ms 1280 KB
rand1 116 ms 1792 KB
rand2 67 ms 1152 KB