Submission #3019844
Source Code Expand
import java.util.*; import java.lang.*; // class Pair implements Comparable<Pair>{ // long a; // int cnt; // public Pair(long i, int j){ // this.a = i; // this.cnt = j; // } // public int compareTo(Pair p){ // if(this.cnt>=2 && p.cnt >=2 && this.a<p.a) return -1; // if(this.cnt<2 && p.cnt>=2) return -1; // return 1; // } // } class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.next()); int M = Integer.parseInt(sc.next()); boolean[] ar = new boolean[N]; boolean[] br = new boolean[N]; for(int i = 0; i<M; i++){ int s = Integer.parseInt(sc.next())-1; int g = Integer.parseInt(sc.next())-1; if(s == 0) ar[g] = true; else if(g == N-1) br[s] = true; } for(int i = 0; i<N; i++){ if(ar[i] && br[i]){ System.out.println("POSSIBLE"); return; } } System.out.println("IMPOSSIBLE"); } }
Submission Info
Submission Time | |
---|---|
Task | C - Cat Snuke and a Voyage |
User | harunatsu |
Language | Java8 (OpenJDK 1.8.0) |
Score | 300 |
Code Size | 1048 Byte |
Status | AC |
Exec Time | 639 ms |
Memory | 63636 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 92 ms | 20688 KB |
example1 | AC | 92 ms | 18644 KB |
example2 | AC | 93 ms | 21204 KB |
example3 | AC | 93 ms | 19668 KB |
last0 | AC | 639 ms | 62484 KB |
last1 | AC | 623 ms | 63052 KB |
many0 | AC | 528 ms | 63636 KB |
many1 | AC | 523 ms | 63540 KB |
rand0 | AC | 489 ms | 50336 KB |
rand1 | AC | 584 ms | 62708 KB |
rand2 | AC | 479 ms | 53240 KB |