# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31229 | tatatan | Fireworks (APIO16_fireworks) | C++11 | 239 ms | 44380 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
#define endl '\n'
using namespace std;
const int MAXN=300005;
int n,m,p[MAXN],c[MAXN];
LL a[MAXN],b[MAXN];
priority_queue<LL> pq[MAXN];
void swap2(int x,int y) {
if(pq[x].size()<pq[y].size()) {
pq[x].swap(pq[y]);
swap(a[x],a[y]);
swap(b[x],b[y]);
}
}
void merge(int x,int y) {
swap2(x,y);
a[x]+=a[y];
b[x]+=b[y];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |