QOJ.ac
QOJ
ID | Submission ID | Problem | Hacker | Owner | Result | Submit time | Judge time |
---|---|---|---|---|---|---|---|
#529 | #319749 | #21694. 【NOIP Round #3】抓内鬼 | cz2010124 | zhangchaozheng2030 | Failed. | 2024-02-03 10:17:07 | 2024-02-03 10:17:07 |
Details
Extra Test:
Invalid Input
input:
a s1d3a2s1d 3
output:
result:
FAIL Expected integer, but "a" found (stdin, line 1)
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#319749 | #21694. 【NOIP Round #3】抓内鬼 | zhangchaozheng2030 | 100 ✓ | 75ms | 4260kb | C++14 | 648b | 2024-02-03 08:03:47 | 2024-02-03 08:03:48 |
answer
#include <bits/stdc++.h>
using namespace std;
int n,m,v,u;
bitset<100005> tn,t1;
char s[100005];
#define c(a,b) (s[a]=b?(u--,'U'):(v--,'P'))
int main(){
cin>>n>>m>>u;
v=n-u;
for(int i=1,w;i<=n;i++) cin>>w;
for(int i=1,u,v;i<=m;i++){
cin>>u>>v;
if(u>v) swap(u,v);
if(u==1) t1[v]=1;
if(v==n) tn[u]=1;
}
if(t1[n]){
if(v==1&&u==1) exit((cout<<"impossible")&&0);
if(v>1) c(1,0),c(n,0);
else c(1,1),c(n,1);
for(int i=2;i<n;i++) c(i,u);
}
else{
basic_string<int> A(1,1),B(1,n);
for(int i=2;i<n;i++) ((t1[i]&&!tn[i])?A:B)+=i;
reverse(B.begin(),B.end());
for(int i:A+B) c(i,u);
}
cout<<(s+1);
}