Submission #7966024
Source Code Expand
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, n) for(int i=n; i>=0; i--)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define inf 1e18
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> T vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> T adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
set<ll> ship[200010];
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
ll n, m, a, b;
cin >> n >> m;
rep(i, m){
cin >> a >> b;
ship[a].insert(b);
ship[b].insert(a);
}
for(auto island : ship[1]){
if(ship[island].find(n) != ship[island].end()){
cout << "POSSIBLE" << endl;
return 0;
}else{
continue;
}
}
cout << "IMPOSSIBLE" << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Cat Snuke and a Voyage |
User |
champon |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
1761 Byte |
Status |
AC |
Exec Time |
158 ms |
Memory |
28416 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 |
5 ms |
9600 KB |
example1 |
AC |
5 ms |
9600 KB |
example2 |
AC |
5 ms |
9600 KB |
example3 |
AC |
5 ms |
9600 KB |
last0 |
AC |
107 ms |
28416 KB |
last1 |
AC |
112 ms |
28416 KB |
many0 |
AC |
158 ms |
28416 KB |
many1 |
AC |
152 ms |
28416 KB |
rand0 |
AC |
62 ms |
21888 KB |
rand1 |
AC |
117 ms |
28160 KB |
rand2 |
AC |
51 ms |
20352 KB |