QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#209195 | #6326. Make Convex Sequence | ucup-team870# | WA | 1ms | 5900kb | C++14 | 1.4kb | 2023-10-10 11:57:24 | 2023-10-10 11:57:24 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=l; i<=r; i++)
#define per(i,r,l) for(int i=r; i>=l; i--)
#define IOS {cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);}
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int N = 200010;
struct node {
int u, v, c;
} e[N];
int fa[N], sz[N], st[N], top;
ll sum1, sum2;
int find(int x) {
while (x != fa[x]) x = fa[x];
return x;
}
void Link(int u, int v) {
int x = find(u), y = find(v);
if (x != y) {
if (sz[x] > sz[y]) swap(x, y), swap(u, v);
sum2 -= 1ll * sz[y] * sz[y];
sum1 -= sz[y];
sum2 -= 1ll * sz[x] * sz[x];
sum1 -= sz[x];
fa[x] = y;
sz[y] += sz[x];
sum2 += 1ll * sz[y] * sz[y];
sum1 += sz[y];
st[++top] = x;
} else {
st[++top] = 0;
}
}
void Cut() {
if (st[top]) {
int x = st[top], y = fa[x];
sum2 -= 1ll * sz[y] * sz[y];
sum1 -= sz[y];
fa[x] = x;
sz[y] -= sz[x];
sum2 += 1ll * sz[y] * sz[y];
sum1 += sz[y];
sum2 += 1ll * sz[x] * sz[x];
sum1 += sz[x];
}
top--;
}
int main() {
int n, m, k;
scanf("%d%d%d", &n, &m, &k);
rep (i, 1, n) fa[i] = i, sz[i] = 1;
rep (i, 1, m) {
scanf("%d%d%d", &e[i].u, &e[i].v, &e[i].c);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5900kb
input:
4 2 1 2 5 4 6 5 8
output:
result:
wrong output format Unexpected end of file - token expected