QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#464547#5029. 在路上MEKHANECompile Error//C++14862b2024-07-06 11:52:472024-07-06 11:52:47

Judging History

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

  • [2024-07-06 11:52:47]
  • 评测
  • [2024-07-06 11:52:47]
  • 提交

answer

#include<bits/stdc++.h>
#include "path.h"
#define rep(i,j,k) for(int i=j;i<=k;i++)
using namespace std;
const int L=1000;
int n,min1,min2,in[L],siz[L],mp[L][L];
vector<int> v[L];
queue<int> que;
void dfs(int x,int fa){
    siz[x]=1; int max1=0;
    for(auto dq:v[x]) dfs(dq),siz[x]+=siz[dq],max1=max(max1,siz[dq]);
    max1=max(max1,n-siz[x]);
    if(max1<min1) min1=max1,min2=x;
}
int centroid(int id,int N,int M){
    n=N;
    rep(i,1,N){siz[i]=in[i]=0,v[i].clear(); rep(j,1,N) mp[i][j]=0;}
    rep(i,2,N) rep(j,i+1,N){
        int res=ask(1,i,j);
        if(res==i) mp[i][j]=1,in[j]++;
        else if(res==j) mp[j][i]=1,in[i]++;
    }que.push(1);
    while(!que.empty()){
        int x=que.front(); que.pop();
        rep(i,1,N) if(mp[x][i]) if(!(--in[i])) v[x].push_back(i),que.push(i);
    }min1=1e18,min2=0,dfs(1); return min2;
}

Details

implementer.cpp: In function ‘int main()’:
implementer.cpp:60:14: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   60 |         fread(Interactor::rbuf,1,50000000,stdin);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
answer.code: In function ‘void dfs(int, int)’:
answer.code:11:26: error: too few arguments to function ‘void dfs(int, int)’
   11 |     for(auto dq:v[x]) dfs(dq),siz[x]+=siz[dq],max1=max(max1,siz[dq]);
      |                       ~~~^~~~
answer.code:9:6: note: declared here
    9 | void dfs(int x,int fa){
      |      ^~~
answer.code: In function ‘int centroid(int, int, int)’:
answer.code:26:11: warning: overflow in conversion from ‘double’ to ‘int’ changes value from ‘1.0e+18’ to ‘2147483647’ [-Woverflow]
   26 |     }min1=1e18,min2=0,dfs(1); return min2;
      |           ^~~~
answer.code:26:26: error: too few arguments to function ‘void dfs(int, int)’
   26 |     }min1=1e18,min2=0,dfs(1); return min2;
      |                       ~~~^~~
answer.code:9:6: note: declared here
    9 | void dfs(int x,int fa){
      |      ^~~