QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#799085#8056. Travel 2123adadWA 1ms3668kbC++23876b2024-12-04 21:48:042024-12-04 21:48:04

Judging History

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

  • [2024-12-04 21:48:04]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3668kb
  • [2024-12-04 21:48:04]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int N=2510;
int d[N],vis[N],road[N][N];
vector<int> e[N];
void dfs(int u){
	int now=e[u].size()-1;
	if(now<d[u]){
		now++;
		cout<<"> "<<now<<endl;
		int v;
		cin>>v>>d[v];
		e[u].push_back(v);
		road[u][v]=now;
		dfs(v);
		return;
	}
	vis[u]=1;
	for(int i=1;i<=now;i++){
		if(!vis[i]){
			int v=road[u][i];
			int x;
			cout<<"> "<<i<<endl;
			cin>>x>>d[x];
			dfs(v);
			cout<<"> "<<road[v][u]<<endl;
			cin>>x>>d[x];
		}
	}
}
void solve(){
	for(int i=0;i<N;i++){
		vis[i]=0;
		e[i].clear();
	}
	int u;
	cin>>u>>d[u];
	dfs(u);
	cout<<"! ";
	for(int i=1;i<N;i++){
		for(auto v:e[i]){
			if(i<v){
				cout<<i<<" "<<v<<" ";
			}
		}
	}
	cout<<endl;
}
int main(){
	ios::sync_with_stdio(0),cin.tie(0);
	int _=1;//cin>>_;
	while(_--) solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3668kb

input:

2
1 1

output:

> 0

result:

wrong answer Integer parameter [name=i] equals to 0, violates the range [1, 1] (test case 1)