Submission #5818572


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(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 521 Byte
Status TLE
Exec Time 2103 ms
Memory 1792 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 4
AC × 9
TLE × 2
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 118 ms 1792 KB
last1 AC 117 ms 1792 KB
many0 TLE 2103 ms 1792 KB
many1 TLE 2103 ms 1792 KB
rand0 AC 77 ms 1280 KB
rand1 AC 116 ms 1792 KB
rand2 AC 68 ms 1152 KB