bdfz_2024_summer/day12/U466168/U466168.cpp
2024-08-16 10:51:09 +08:00

80 lines
1.4 KiB
C++

//60%Points k==1 & 1->k->n
#include<bits/stdc++.h>
#include <cstdlib>
using namespace std;
struct Node{
vector<int> next;
int t;
};
const int MAX_N = 2e5+5;
int n,m,k;
Node nodes[MAX_N];
int readint();
void AC_KE_Q1();
int main(){
n=readint(),m=readint(),k=readint();
for(int i=1;i<=n;i++){
nodes[i].t=readint();
}
for(int i=1;i<=m;i++){
const int u=readint(),v=readint();
nodes[u].next.push_back(v);
nodes[v].next.push_back(u);
}
if(k==1){AC_KE_Q1();exit(0);}
int uNum=k-1;
cout<<"P";
for(int i=2;i<n;i++){
if(uNum){
uNum--;
cout<<"U";
}else{
cout<<"P";
}
}
cout<<"U"<<endl;
}
void AC_KE_Q1(){
bool isUPrint = false;
for(int i=1;i<=n;i++){
if (!isUPrint) {
bool canPrint = true;
for(auto i:nodes[i].next){
if(i==n){
canPrint=false;
break;
}
}
if(canPrint){
cout<<"U";
isUPrint=true;
goto printed;
}
}
cout<<"P";
printed:;
}
cout<<endl;
}
int readint(){
int x=0,w=1;
char ch=0;
while(!isdigit(ch)){
if(ch=='-')w=-1;
ch=getchar();
}
while(isdigit(ch)){
x=x*10+(ch-'0');
ch=getchar();
}
return x*w;
}