Submission #1462550
Source Code Expand
#include <iostream> #include <vector> #include <algorithm> #include <numeric> #define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++) using namespace std; typedef long long ll; ll N, M; vector<ll> E[200000]; int main(void) { cin >> N >> M; REP(i, 0, M) { ll A, B; cin >> A >> B; A--; B--; E[A].push_back(B); E[B].push_back(A); } bool ans = false; REP(i, 0, E[0].size()) { REP(j, 0, E[E[0][i]].size()) if(E[E[0][i]][j] == N - 1) ans = true; } cout << (ans ? "POSSIBLE" : "IMPOSSIBLE") << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - Cat Snuke and a Voyage |
User | kshinya |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 573 Byte |
Status | AC |
Exec Time | 167 ms |
Memory | 12776 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 | 3 ms | 4992 KB |
example1 | AC | 3 ms | 4992 KB |
example2 | AC | 3 ms | 4992 KB |
example3 | AC | 3 ms | 4992 KB |
last0 | AC | 167 ms | 11904 KB |
last1 | AC | 167 ms | 11904 KB |
many0 | AC | 136 ms | 12776 KB |
many1 | AC | 136 ms | 12776 KB |
rand0 | AC | 114 ms | 9856 KB |
rand1 | AC | 162 ms | 11776 KB |
rand2 | AC | 94 ms | 9344 KB |