Submission #25835

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
258352017-06-24 09:40:44gs14004Ball Machine (BOI13_ballmachine)C++11
100 / 100
803 ms24080 KiB
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
int n, q;
int dfn[100005], rev[100005];
int par[100005][17];
int dep[100005];
vector<int> graph[100005];
int piv;
int root;
int min_sub[100005];
int prep(int x){
min_sub[x] = x;
for(int ii=0; ii<graph[x].size(); ii++){
int i = graph[x][ii];
min_sub[x] = min(min_sub[x],prep(i));
}
return min_sub[x];
}
bool cmp(int a, int b){
return min_sub[a] < min_sub[b];
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

ballmachine.cpp: In function 'int prep(int)':
ballmachine.cpp:21:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int ii=0; ii<graph[x].size(); ii++){
                     ^
ballmachine.cpp: In function 'void dfs(int)':
ballmachine.cpp:36:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int ii=0; ii<graph[x].size(); ii++){
                     ^
ballmachine.cpp: In function 'int main()':
ballmachine.cpp:48:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&n,&q);
                         ^
ballmachine.cpp:51:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&par[i][0]);
                               ^
ballmachine.cpp:62:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d",&a,&b);
                             ^
ballmachine.cpp:66:19: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
             printf("%d\n",rev[p]);
                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...