Submission #1462637


Source Code Expand

Copy
#include <bits/stdc++.h>

#define x first
#define y second

#ifdef ONLINE_JUDGE
#define DEBUG(x)
#else
#define DEBUG(x) cerr << #x << ": " << x << endl;
#endif

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

const int mod=1000000000+7;

int addm(int& a,int b) {return (a+=b)<mod?a:a-=mod;}

template<class T,class U> bool smin(T& a,U b) {return a>b?(a=b,1):0;}
template<class T,class U> bool smax(T& a,U b) {return a<b?(a=b,1):0;}

bool a[200000],b[200000];
int N,M;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> N >> M;
	for (int i=0;i<M;i++) {
		int u,v;cin >> u >> v;u--;v--;
		if (u==0) a[v]=1;
		if (v+1==N) b[u]=1;
	}
	for (int i=0;i<N;i++) if (a[i]&&b[i]) {
		cout << "POSSIBLE\n";
		return 0;
	}
	cout << "IMPOSSIBLE\n";
}

Submission Info

Submission Time
Task C - Cat Snuke and a Voyage
User Whalanator
Language C++14 (GCC 5.4.1)
Score 300
Code Size 912 Byte
Status AC
Exec Time 34 ms
Memory 640 KB

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 1 ms 256 KB
example1 AC 1 ms 256 KB
example2 AC 1 ms 256 KB
example3 AC 1 ms 256 KB
last0 AC 34 ms 256 KB
last1 AC 34 ms 256 KB
many0 AC 34 ms 640 KB
many1 AC 33 ms 640 KB
rand0 AC 22 ms 256 KB
rand1 AC 33 ms 256 KB
rand2 AC 20 ms 256 KB