提出 #1465217


ソースコード 拡げる

#include<iostream>
using namespace std;

int n, m;
int start[200005], goal[200005];

int main(void){
  cin >> n >> m;
  for(int i = 0; i < m; i++){
    int s, t;
    cin >> s >> t;
    if(s == 1){
      start[t] = 1;
    }
    if(t == n){
      goal[s] = 1;
    }
  }
  for(int i = 0; i < n; i++){
    if(start[i] == 1 and goal[i] == 1){
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }
  cout << "IMPOSSIBLE" << endl;
}

提出情報

提出日時
問題 C - Cat Snuke and a Voyage
ユーザ alex00
言語 C++14 (GCC 5.4.1)
得点 300
コード長 458 Byte
結果 AC
実行時間 152 ms
メモリ 1792 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 4
AC × 11
セット名 テストケース
Sample example0, example1, example2, example3
All example0, example1, example2, example3, last0, last1, many0, many1, rand0, rand1, rand2
ケース名 結果 実行時間 メモリ
example0 AC 1 ms 256 KiB
example1 AC 1 ms 256 KiB
example2 AC 1 ms 256 KiB
example3 AC 1 ms 256 KiB
last0 AC 152 ms 256 KiB
last1 AC 149 ms 256 KiB
many0 AC 139 ms 1792 KiB
many1 AC 137 ms 1792 KiB
rand0 AC 99 ms 256 KiB
rand1 AC 147 ms 256 KiB
rand2 AC 87 ms 256 KiB