QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#719253#8056. Travel 2FHQYWA 3ms3720kbC++201.2kb2024-11-06 23:40:322024-11-06 23:40:33

Judging History

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

  • [2024-11-06 23:40:33]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3720kb
  • [2024-11-06 23:40:32]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define ll long long
using namespace std;
const ll maxn=2505,maxm=1e4+5;
ll tot,s[maxn];
pair<ll,ll>gt(ll x){
	ll res=0,siz=0;
	cout<<"> "<<x<<endl;
	cin>>res>>siz;
	s[res]=siz;
	return make_pair(res,siz);
	tot++;
}
ll e[maxn][maxn];
vector<ll>lst[maxn];
ll cur[maxn];
void dfs(ll x,ll siz,ll fa){
	if(e[x][fa]){
//		cout<<"from "<<x<<" back "<<fa<<endl;
		gt(e[x][fa]);
		return ;
	}
//	cout<<"now "<<x<<" "<<cur[x]<<endl;
	while(cur[x]<=siz){
		pair<ll,ll>res=gt(cur[x]);
//		cout<<"now "<<x<<" "<<res.first<<endl;
		e[x][res.first]=cur[x];
		lst[x].push_back(res.first);
		cur[x]++;
		dfs(res.first,res.second,x);
	}
	if(e[x][fa]&&cur[fa]<=s[fa])gt(e[x][fa]);
	return ;
}
string c;
void solve()
{
	tot=0;
	for(ll i=1;i<=2500;i++){
		cur[i]=1;
		s[i]=0;
		for(auto it:lst[i])e[i][it]=0;
		lst[i].clear();
	}
	ll x=0,siz=0;
	cin>>x>>siz;
	dfs(x,siz,0);
	cout<<"! ";
	for(ll i=1;i<=2500;i++){
		if(lst[i].empty())continue;
		for(auto it:lst[i]){
			if(i<it)cout<<i<<" "<<it<<" ";
		}
	}
	cin>>c;
//	cout<<endl;
//	for(ll i=1;i<=4;i++)cout<<cur[i]<<endl;
//	cout<<tot<<endl;
	cout<<endl;
	return ;
}

signed main()
{
	int T;
	cin>>T;
	while(T--)
		solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3600kb

input:

2
1 1
2 1
1 1
2 1
Correct
1 3
2 2
1 3
2 2
4 2
1 3
3 1
1 3
3 1
1 3
4 2
1 3
4 2
2 2
4 2
Correct

output:

> 1
> 1
> 1
! 1 2 
> 1
> 1
> 1
> 2
> 1
> 2
> 1
> 2
> 1
> 3
> 1
> 3
> 2
> 2
! 1 2 1 3 1 4 2 4 

result:

ok correct! (2 test cases)

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 3720kb

input:

1000
1 9
2 7
1 9
2 7
3 9
1 9
3 9
1 9
4 9
1 9
4 9
3 9
4 9
3 9
9 8
1 9
5 8
1 9
5 8
8 8
1 9
6 9
1 9
6 9
2 7
10 6
1 9
7 7
1 9
7 7
4 9
7 7
4 9
10 6
2 7
10 6
8 8
5 8
8 8
10 6
8 8
9 8
3 9
9 8
5 8
9 8
5 8
2 7
6 9
2 7
5 8
2 7
9 8
2 7
9 8
8 8
9 8
7 7
8 8
7 7
8 8
3 9
2 7
3 9
5 8
3 9
5 8
6 9
10 6
4 9
10 6
6 9
1...

output:

> 1
> 1
> 1
> 2
> 1
> 2
> 1
> 3
> 1
> 3
> 2
> 2
> 2
> 3
> 1
> 4
> 1
> 4
> 2
> 1
> 5
> 1
> 5
> 2
> 3
> 1
> 6
> 1
> 6
> 2
> 3
> 2
> 4
> 2
> 3
> 3
> 2
> 2
> 3
> 3
> 4
> 2
> 3
> 3
> 3
> 3
> 4
> 4
> 2
> 5
> 4
> 6
> 4
> 6
> 5
> 4
> 6
> 3
> 5
> 3
> 6
> 4
> 2
> 5
> 5
> 5
> 6
> 3
> 4
> 4
> 5
> 3
> 6
> 6
> 6
...

result:

wrong answer you used more than 100 queries. (test case 1)