Submission #1873424


Source Code Expand

#include <bits/stdc++.h>
#define N 200010
using namespace std;

inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int F1[N],F2[N],n,m;
int main()
{
	n=read(); m=read();
	F1[1]=1; F2[n]=1;
	for(int i=1;i<=m;i++)
	{
		int x=read(), y=read();
		if(x==1) F1[y]=1; if(y==1) F1[x]=1;
		if(y==n) F2[x]=1; if(x==n) F2[y]=1;
	}
	for(int i=1;i<=n;i++)
		if(F1[i]&F2[i])
		{
			puts("POSSIBLE");
			return 0;
		}
	puts("IMPOSSIBLE");
	return 0;
}

Submission Info

Submission Time
Task C - Cat Snuke and a Voyage
User wcz111
Language C++14 (GCC 5.4.1)
Score 300
Code Size 593 Byte
Status AC
Exec Time 24 ms
Memory 1792 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 24 ms 256 KB
last1 AC 24 ms 256 KB
many0 AC 20 ms 1792 KB
many1 AC 20 ms 1792 KB
rand0 AC 16 ms 256 KB
rand1 AC 24 ms 256 KB
rand2 AC 14 ms 256 KB