QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#209195#6326. Make Convex Sequenceucup-team870#WA 1ms5900kbC++141.4kb2023-10-10 11:57:242023-10-10 11:57:24

Judging History

你现在查看的是最新测评结果

  • [2023-10-10 11:57:24]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5900kb
  • [2023-10-10 11:57:24]
  • 提交

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