QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#771735#1774. Customs Controlse_kidWA 1ms3668kbC++141.4kb2024-11-22 15:20:482024-11-22 15:20:50

Judging History

你现在查看的是最新测评结果

  • [2024-11-22 15:20:50]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3668kb
  • [2024-11-22 15:20:48]
  • 提交

answer

// Problem: B. 【NOIP Round #3】抓内鬼
// Contest: Public Judge - Public NOIP Round #3 (Div. 1, 提高)
// URL: https://pjudge.ac/contest/1030/problem/21694
// Memory Limit: 1024 MB
// Time Limit: 3000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
#define int long long 
#define rep(i,a,b)	for(int i = (a);i<=(b);i++)
#define lep(i,a,b)	for(int i = (a);i>=(b);i--)
using namespace std;
const int N = 2e5+10;
int n,m,k,flag,u,v;
int t[N];
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m>>k;
	if(k == 1){
		rep(i,1,n)	cin>>t[i];
		rep(i,1,m){
			cin>>u>>v;
			if(u>v)	swap(u,v);
			if(u == 1 && v == n)	flag = 1;
		}
		if(flag && n<=2)	cout<<"impossible";
		else{
			if(!flag){
				cout<<'U';
				rep(i,1,n-1)	cout<<'P';
			}
			else{
				cout<<"PU";
				rep(i,1,n-2)	cout<<'P';
			}
		}
	}
	else{
		rep(i,1,n)	cin>>t[i];
		rep(i,1,m){
			cin>>u>>v;
			if(u>v)	swap(u,v);
			if(u == 1 && v == n)	flag = 1;
		}
		if(flag && n<=2 && k == 1)	cout<<"impossible";
		else{
			if(!flag){
				cout<<'P';
				rep(i,1,n-k-1)	cout<<'P';
				rep(i,1,k)	cout<<'U';
			}
			else{
				if(n<=2){
					if(!k)	cout<<"PP";
					else cout<<"UU";
				}
				else{
					cout<<'P';
					rep(i,1,n-k-2)	cout<<'P';
					rep(i,1,k)	cout<<'U';
					cout<<'P';
				}
			}
		}
	}
	return 0;	
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3668kb

input:

5 10 2
1 1 1 1 1
3 4
5 4
3 1
4 1
3 5
2 1
2 4
2 5
1 5
2 3

output:

PPUUP

result:

wrong answer invalid character