QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#797276#8056. Travel 2wantsthWA 5ms5788kbC++231.4kb2024-12-02 20:05:532024-12-02 20:05:54

Judging History

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

  • [2024-12-02 20:05:54]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:5788kb
  • [2024-12-02 20:05:53]
  • 提交

answer

#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
int vis[3000]={0};
set<pii>ans;
queue<int>e[3000];
pii query(int i)
{
	pii res;
	cout<<"> "<<i<<endl;
	cin>>res.fi>>res.se;
	return res;
}
void dfs(int q,int fa,int c)
{
	//cout<<fa<<" "<<q<<" "<<c<<endl;
	if(e[q].size()==0)
	return;
	
	int nx=e[q].front();
	e[q].pop();
	pii nxt=query(nx);
	if(nxt.fi==fa&&e[q].size()!=0)
	{
		e[q].push(nx);
		//nx=e[q].front();
		nxt=query(c);
	    nx=e[q].front();
	    e[q].pop();
	    nxt=query(nx);
	}
	pii y;
		if(nxt.fi<q)
		{
			y={nxt.fi,q};
		}
		else
		{
			y={q,nxt.fi};
		}
	    ans.insert(y);
	//cout<<q<<" "<<e[q].size()<<endl;
	if(vis[nxt.fi]==0)
	{
		for(int i=1;i<=nxt.se;i++)
		{
			e[nxt.fi].push(i);
		}
		vis[nxt.fi]=1;
	}
	dfs(nxt.fi,q,nx);
	return;
}
void solve()
{
	ans.clear();
	for(int i=0;i<=2800;i++)
	{
		vis[i]=0;
		while(e[i].size()>0)
		{
			e[i].pop();
		}
	//	cout<<i<<endl;
	}
	int qi,shu;
	cin>>qi>>shu;
	for(int i=1;i<=shu;i++)
	{
		e[qi].push(i);
	}
	vis[qi]=1;
	dfs(qi,0,0);
	cout<<"! ";
	for(auto i=ans.begin();i!=ans.end();i++)
	{
		pii p=*i;
		cout<<p.fi<<" "<<p.se<<" ";
	}
	cout<<endl;
	string str;
	cin>>str;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int T;
	cin>>T;
	while(T--)
	{
		solve();
	}
 } 

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 5788kb

input:

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

output:

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

result:

ok correct! (2 test cases)

Test #2:

score: -100
Wrong Answer
time: 5ms
memory: 5616kb

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
6 9
10 6
8 8
5 8
9 8
3 9
2 7
5 8
2 7
5 8
3 9
5 8
3 9
10 6
4 9
8 8
10 6
6 9
5 8
6 9
5 8
7 7
8 8
9 8
5 8
4 9
5 8
4 9
2 7
9 8
2 7
9 8
8 8
7 7
5 8
1 9
8 8
3 ...

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
> 4
> 3
> 3
> 2
> 3
> 2
> 4
> 5
> 4
> 5
> 5
> 5
> 5
> 6
> 4
> 5
> 3
> 5
> 4
> 6
> 4
> 7
> 3
> 4
> 3
> 8
> 6
> 8
> 7
> 6
> 4
> 6
> 5
> 5
> 4
> 1
> 7
> 6
> 7
> 6
> 8
...

result:

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