QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#115551#4926. Where Is the Root?jamielimCompile Error//C++14800b2023-06-26 11:37:412023-06-26 11:38:07

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-26 11:38:07]
  • 评测
  • [2023-06-26 11:37:41]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(),x.end()
typedef pair<int,int> ii;
typedef long long ll;
typedef unsigned long long ull;
const int INF=1012345678;
const ll LLINF=1012345678012345678LL;
const ll MOD=1000000007;

int n;
vector<int> adj[505];
int dist[2][505];
int fr;
int dep[505];
int maxdep;
vector<int> leaf;

int main(){
	scanf("%d",&n);
	int a,b;
	for(int i=1;i<n;i++){
		scanf("%d%d",&a,&b);
		adj[a].pb(b);adj[b].pb(a);
	}
	for(int i=1;i<=n;i++){
		vector<int> v;
		for(int j=1;j<=n;j++){
			if(i==j)continue;
			v.pb(j);
		}
		if(!query(v)){
			printf("! %d\n",i);
			fflush(stdout);
			break;
		}
	}
}

Details

answer.code: In function ‘int main()’:
answer.code:38:21: error: ‘query’ was not declared in this scope
   38 |                 if(!query(v)){
      |                     ^~~~~
answer.code:26:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
answer.code:29:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   29 |                 scanf("%d%d",&a,&b);
      |                 ~~~~~^~~~~~~~~~~~~~