Submission #1225543

#TimeUsernameProblemLanguageResultExecution timeMemory
1225543TrumlingTree (IOI24_tree)C++20
Compilation error
0 ms0 KiB
//Trumling © //Αφόδευε υψηλά και ηγνάντει #include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define F first #define S second #define enter cout<<'\n'; #define INF 99999999999999 #define MOD 1000000007 #define all(x) x.begin(),x.end() #include "tree.h" int n; vector<ll> w; vector<ll>f; vector<vector<ll>>g; vector<priority_queue<pair<ll,ll>>>v; ll ans=0; void dfs(int start,int pre,int L,int R) { for(auto x:g[start]) if(x!=pre) { dfs(x,start,L,R); f[start]+=f[x]; while(!v[x].empty()) { v[start].push(v[x].top()); v[x].pop(); } } if(f[start]==0) { f[start]=L; ans+=w[start]*L; } while(f[start]>R && !v[start].empty() && -v[start].top().F < w[start]) { pair<ll,ll>curr=v[start].top(); v[start].pop(); ll can=curr.S; ll must=f[start]-R; if(can>must) { curr.S-=must; f[start]-=must; ans+=must*(-curr.F); v[start].push(curr); } else { curr.S-=can; f[start]-=can; ans+=can*(-curr.F); } } if(f[start]>R) { ans+=(f[start]-R)*w[start]; f[start]=R; } v[start].push({-w[start],f[start] - L}); ll used=0; priority_queue<pair<ll,ll>>pq; while(!v[start].empty() && used < (f[start] - L)) { pair<ll,ll>curr=v[start].top(); v[start].pop(); ll can = min(f[start] - L - used , curr.S); curr.S = can; pq.push(curr); used+=can; } v[start]=pq; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccAiANyV.o: in function `main':
grader.cpp:(.text.startup+0x2fd): undefined reference to `init(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: grader.cpp:(.text.startup+0x3c2): undefined reference to `query(int, int)'
collect2: error: ld returned 1 exit status