Submission #360040

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3600402021-01-27 12:22:26keta_tsimakuridzeConstruction of Highway (JOI18_construction)C++14
100 / 100
1462 ms20844 KiB
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
using namespace std;
const int N=1e5+5;
int sz[N],par[N],lazy[4*N],ind[N],c[N],cur,idx,k,i,a[N],b[N],n,st[N],f[N],ch[N],s[N];
pair<int,int>d[N],tree[4*N];
vector<int>V[N];
void dfs(int u,int p){
sz[u]=1; par[u]=p;
for(int i=0;i<V[u].size();i++){
if(V[u][i]!=p) dfs(V[u][i],u),sz[u]+=sz[V[u][i]];
}
}
void update(int u,int start,int end,int l,int r,int val){
if(lazy[u]){
tree[u]={lazy[u],lazy[u]};
if(l!=r){
lazy[2*u]=lazy[u];
lazy[2*u+1]=lazy[u];
}
lazy[u]=0;
}
if(l>end || r<start) return;
if(start<=l && r<=end) {
tree[u]={val,val};
if(l!=r){
lazy[2*u]=val;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

construction.cpp: In function 'void dfs(int, int)':
construction.cpp:12:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |  for(int i=0;i<V[u].size();i++){
      |              ~^~~~~~~~~~~~
construction.cpp: In function 'void hld(int, int)':
construction.cpp:65:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |  for(int i=0;i<V[u].size();i++){
      |              ~^~~~~~~~~~~~
construction.cpp:73:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |  for(int i=0;i<V[u].size();i++){
      |              ~^~~~~~~~~~~~
construction.cpp: In function 'void update(int, int)':
construction.cpp:80:6: warning: statement has no effect [-Wunused-value]
   80 |  for(ind;ind<=n;ind+=ind&(-ind))
      |      ^~~
construction.cpp: In function 'long long int getans(int)':
construction.cpp:85:6: warning: statement has no effect [-Wunused-value]
   85 |  for(ind;ind>=1;ind-=ind&(-ind))
      |      ^~~
construction.cpp: In function 'long long int upd(int, int)':
construction.cpp:111:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  111 |  for(int i=0;i<v.size();i++){
      |              ~^~~~~~~~~
construction.cpp:91:20: warning: unused variable 'U' [-Wunused-variable]
   91 |  long long ans = 0,U=u;
      |                    ^
construction.cpp: At global scope:
construction.cpp:116:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  116 |  main(){
      |       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...