Submission #38869

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
388692018-01-07 12:34:16moonrabbit2트리 (KOI16_tree)C++14
100 / 100
456 ms38356 KiB
#include <bits/stdc++.h>
#define N 200005
#define pb push_back
using namespace std;
typedef long long ll;
int n,q,par[N];
vector<int> child[N];
int sub[N],lev[N];
vector<int> chain[N];
int where[N],place[N],c_chain;
vector<ll>tree[N];
bool linked[N];
void dfs(int curr)
{
sub[curr]=1;
for(auto &i : child[curr]){
lev[i]=lev[curr]+1;
dfs(i);
sub[curr]+=sub[i];
}
}
void hld(int curr)
{
where[curr]=c_chain;
chain[c_chain].pb(curr);
int idx=-1;
for(auto &i : child[curr]){
if(idx==-1||sub[i]>sub[idx])
idx=i;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

tree.cpp: In function 'void add(int, int, ll)':
tree.cpp:53:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(pos<tree[num].size()){
              ^
tree.cpp: In function 'int main()':
tree.cpp:96:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=1;j<chain[i].size();j++){
                      ^
tree.cpp:85:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
      scanf("%d %d",&n,&q);
                          ^
tree.cpp:88:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
                       ^
tree.cpp:103:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d",&x,&y,&z);
                                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...