QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#720037 | #8056. Travel 2 | qzez# | WA | 0ms | 3580kb | C++14 | 1.4kb | 2024-11-07 10:22:25 | 2024-11-07 10:22:25 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int maxn=2505;
const int maxm=10005;
bool ed;
int T,n,num,po;
vector<int> G[maxn];
int d[maxn],cur[maxn],cc[maxn];
bool vis[maxn];
void End(){
cout<<"!";
for(int i=1;i<=n;++i){
for(auto s:G[i]){
if(s<i) continue;
cout<<" "<<i<<" "<<s;
}
}
cout<<endl;
string s;
cin>>s;
if(s=="Wrong"){
exit(0);
}
}
void work(int fr){
int pos,du;
cin>>pos>>du;
if(!d[pos]){
d[pos]=du;
n++;
}
if(fr) G[fr].push_back(pos);
if(cur[pos]!=d[pos]){
cur[pos]++;
cout<<"> "<<cur[pos]<<endl;
work(pos);
}else po=pos;
}
void check(int p,int fr){
vis[p]=1;
if(cur[p]!=d[p]) work(0);
for(int i=0;i<d[p];++i){
if(!vis[G[p][i]]){
cout<<"> "<<i+1<<endl;
check(G[p][i],p);
}
}
num++;
for(int i=0;i<d[p];++i){
if(G[p][i]==fr){
cout<<"> "<<i+1<<endl;
return ;
}
}
if(n==num){
End();
}
}
int main(){
cin>>T;
while(T--){
n=num=0;
ed=0;
work(0);
check(po,0);
for(int i=1;i<=n;++i){
G[i].clear();
d[i]=cur[i]=cc[i]=0;
vis[i]=0;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3580kb
input:
2 1 1 2 1 1 1 2 1 1 1 Correct 1 3 2 2
output:
> 1 > 1 > 1 > 1 ! 1 2 > 1 ! 1 1
result:
wrong answer format Unexpected end of file - int32 expected (test case 2)