Submission #1865293


Source Code Expand

#include <cstdio>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

typedef long long ll;

bool can1[200000+10];
bool can2[200000+10];

int main(void) {
  int n, nEdge;
  scanf("%d%d", &n, &nEdge);
  REP(i, nEdge) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a;
    --b;
    if(a == 0) {
      can1[b] = true;
    }
    if(b == 0) {
      can1[a] = true;
    }
    if(a == n-1) {
      can2[b] = true;
    }
    if(b == n-1) {
      can2[a] = true;
    }
  }
  bool res = false;
  REP(i, n) {
    if(can1[i] && can2[i]) {
      res = true;
    }
  }
  puts(res ? "POSSIBLE" : "IMPOSSIBLE");
  
  return 0;
}

Submission Info

Submission Time
Task C - Cat Snuke and a Voyage
User ush
Language C++14 (GCC 5.4.1)
Score 300
Code Size 700 Byte
Status AC
Exec Time 35 ms
Memory 512 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:14:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &n, &nEdge);
                            ^
./Main.cpp:17:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &a, &b);
                          ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 11
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 0 ms 128 KB
example1 AC 0 ms 128 KB
example2 AC 1 ms 128 KB
example3 AC 0 ms 128 KB
last0 AC 34 ms 128 KB
last1 AC 34 ms 128 KB
many0 AC 35 ms 512 KB
many1 AC 35 ms 512 KB
rand0 AC 22 ms 128 KB
rand1 AC 34 ms 128 KB
rand2 AC 20 ms 128 KB