Submission #231409

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2314092020-05-13 14:04:45thebesSynchronization (JOI13_synchronization)C++14
100 / 100
910 ms28024 KiB
#include <bits/stdc++.h>
using namespace std;
const int MN = 1e5+5, LG = 19;
int st[3*MN], lz[3*MN], sp[MN][LG], N, M, Q, i, x, y, dep[MN], vis[MN][2], lst[MN], nxt, sz[MN], on[MN];
pair<int,int> e[MN];
vector<int> adj[MN];
inline void upd_lz(int i,int s,int e){
st[i] += lz[i];
if(s!=e){
lz[2*i] += lz[i];
lz[2*i+1] += lz[i];
}
lz[i] = 0;
}
void upd(int i,int s,int e,int ss,int se,int v){
upd_lz(i, s, e);
if(s>=ss&&e<=se){lz[i]=v; upd_lz(i,s,e);}
else{
if((s+e)/2<ss) upd(2*i+1,(s+e)/2+1,e,ss,se,v),upd_lz(2*i,s,(s+e)/2);
else if((s+e)/2>=se) upd(2*i,s,(s+e)/2,ss,se,v),upd_lz(2*i+1,(s+e)/2+1,e);
else upd(2*i,s,(s+e)/2,ss,se,v),upd(2*i+1,(s+e)/2+1,e,ss,se,v);
st[i]=st[2*i]+st[2*i+1];
}
}
int qu(int i,int s,int e,int idx){
upd_lz(i,s,e);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

synchronization.cpp: In function 'int main()':
synchronization.cpp:78:13: warning: unused variable 'p' [-Wunused-variable]
         int p=e[x].first, c=e[x].second;
             ^
synchronization.cpp:59:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(scanf("%d%d%d",&N,&M,&Q),i=1;i<N;i++){
         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
synchronization.cpp:60:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&x,&y);
         ~~~~~^~~~~~~~~~~~~~
synchronization.cpp:77:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
         ~~~~~^~~~~~~~~
synchronization.cpp:92:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
         ~~~~~^~~~~~~~~
#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...