제출 #99082

#제출 시각아이디문제언어결과실행 시간메모리
99082rzbtBall Machine (BOI13_ballmachine)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair

#define MAXN 100005
using namespace std;
int predak[MAXN][22];
vector<int> niz1[MAXN],niz[MAXN],obilazak;
int minimum[MAXN];
int koren,vreme;
int to[MAXN];
int dfs1(int t){
    int m=t;
    for(auto x:niz1[t])
        m=min(t,dfs1(x));
    minimum[t]=m;
    return m;
}


voiid dfs2(int t){
    for(auto x:niz1[t])
        dfs2(x);
    obilazak.pb(t);
    vreme++;
    to[t]=vreme;
}
bool comp(int a,int b){
    return minimum[a]<minimum[b];
}
int main()
{
    int n,q;
    for(int i=1;i<=n;i++){
        scanf("%d",&predak[i][0]);

        else koren=i;
    }
    dfs1(koren);
    for(int i=1;i<=n;i++){
        sort(niz1[i].begin(),niz1[i].end(),comp);
    }
    dfs2(koren);
    for(auto t:obilazak)
        for(auto x:niz1[t])
            niz[to[t]].pb(x);
    koren=n;


    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

ballmachine.cpp:21:1: error: 'voiid' does not name a type; did you mean 'void'?
 voiid dfs2(int t){
 ^~~~~
 void
ballmachine.cpp: In function 'int main()':
ballmachine.cpp:37:9: error: 'else' without a previous 'if'
         else koren=i;
         ^~~~
ballmachine.cpp:43:5: error: 'dfs2' was not declared in this scope
     dfs2(koren);
     ^~~~
ballmachine.cpp:43:5: note: suggested alternative: 'dfs1'
     dfs2(koren);
     ^~~~
     dfs1
ballmachine.cpp:33:11: warning: unused variable 'q' [-Wunused-variable]
     int n,q;
           ^
ballmachine.cpp:35:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&predak[i][0]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~