Submission #996605

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9966052024-06-10 21:54:53jj_masterJobs (BOI24_jobs)C++17
58 / 100
114 ms61656 KiB
/** Baltic Olympiad in Informatics 2024 **/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 300001;
vector<int> adj[maxn];
int a[maxn];
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> v[maxn];
void dfs(int x) {
for(int i : adj[x]) {
dfs(i);
if(v[i].size() > v[x].size()) {
swap(v[i], v[x]);
}
while(v[i].size()) {
v[x].push(v[i].top());
v[i].pop();
}
}
if(a[x] >= 0) {
v[x].push({0, a[x]});
} else {
pair<int, int> cur = {-a[x], a[x]};
while(v[x].size() && cur.second < 0) {
pair<int, int> tmp = v[x].top();
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...