QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#413333#1148. Gamekwongweng#0 0ms3848kbC++171.0kb2024-05-17 13:09:162024-05-17 13:09:18

Judging History

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

  • [2024-05-17 13:09:18]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3848kb
  • [2024-05-17 13:09:16]
  • 提交

answer

#include "game.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef vector<vector<ll>> vll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define ms memset
#define fi first
#define se second

const int mxn = 1500;
vi p(mxn), sz(mxn);
int e[mxn][mxn];
int n;
set<int> par;

int get(int a){
    return p[a] = (p[a]==a ? a : get(p[a]));
}

void Union(int a, int b){
    if (sz[a] < sz[b]) swap(a,b);
    p[b]=a; sz[a] += sz[b];
    par.erase(b);
    for (int u : par){
        if (u==a) continue;
        e[a][u]=e[u][a]=e[u][b]+e[u][a];
    }
}

void initialize(int N) {
    n=N;
    FOR(i,0,n){
        p[i]=i;
        FOR(j,0,n) e[i][j]=e[j][i]=1;
        par.insert(i);
    }
}

int hasEdge(int u, int v) {
    u = get(u); v = get(v);
    e[u][v]--;
    if (e[u][v]==0){
        Union(u,v); return 1;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 15
Accepted
time: 0ms
memory: 3628kb

input:

4
0 1
3 0
1 2
0 2
3 1
2 3

output:

1
0
0
1
0
0

result:

ok correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

4
0 3
2 0
0 1
1 2
1 3
2 3

output:

1
0
0
1
0
0

result:

ok correct

Test #3:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

4
0 3
1 0
0 2
3 1
1 2
2 3

output:

1
0
0
0
1
0

result:

ok correct

Test #4:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

4
3 1
1 2
0 2
0 3
1 0
3 2

output:

1
0
1
0
0
0

result:

ok correct

Test #5:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

4
1 2
2 3
2 0
1 0
3 1
0 3

output:

1
0
0
1
0
0

result:

ok correct

Test #6:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

4
2 0
0 3
1 2
1 0
3 1
3 2

output:

1
0
0
1
0
0

result:

ok correct

Test #7:

score: -15
Wrong Answer
time: 0ms
memory: 3828kb

input:

4
3 0
0 1
1 3
0 2
2 3
1 2

output:

1
0
0
0
0
1

result:

wrong answer not correct

Subtask #2:

score: 0
Wrong Answer

Test #25:

score: 27
Accepted
time: 0ms
memory: 3592kb

input:

4
0 1
3 0
1 2
0 2
3 1
2 3

output:

1
0
0
1
0
0

result:

ok correct

Test #26:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

4
0 3
2 0
0 1
1 2
1 3
2 3

output:

1
0
0
1
0
0

result:

ok correct

Test #27:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

4
0 3
1 0
0 2
3 1
1 2
2 3

output:

1
0
0
0
1
0

result:

ok correct

Test #28:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

4
3 1
1 2
0 2
0 3
1 0
3 2

output:

1
0
1
0
0
0

result:

ok correct

Test #29:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

4
1 2
2 3
2 0
1 0
3 1
0 3

output:

1
0
0
1
0
0

result:

ok correct

Test #30:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

4
2 0
0 3
1 2
1 0
3 1
3 2

output:

1
0
0
1
0
0

result:

ok correct

Test #31:

score: -27
Wrong Answer
time: 0ms
memory: 3800kb

input:

4
3 0
0 1
1 3
0 2
2 3
1 2

output:

1
0
0
0
0
1

result:

wrong answer not correct

Subtask #3:

score: 0
Wrong Answer

Test #79:

score: 58
Accepted
time: 0ms
memory: 3712kb

input:

4
0 1
3 0
1 2
0 2
3 1
2 3

output:

1
0
0
1
0
0

result:

ok correct

Test #80:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

4
0 3
2 0
0 1
1 2
1 3
2 3

output:

1
0
0
1
0
0

result:

ok correct

Test #81:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

4
0 3
1 0
0 2
3 1
1 2
2 3

output:

1
0
0
0
1
0

result:

ok correct

Test #82:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

4
3 1
1 2
0 2
0 3
1 0
3 2

output:

1
0
1
0
0
0

result:

ok correct

Test #83:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

4
1 2
2 3
2 0
1 0
3 1
0 3

output:

1
0
0
1
0
0

result:

ok correct

Test #84:

score: 0
Accepted
time: 0ms
memory: 3760kb

input:

4
2 0
0 3
1 2
1 0
3 1
3 2

output:

1
0
0
1
0
0

result:

ok correct

Test #85:

score: -58
Wrong Answer
time: 0ms
memory: 3756kb

input:

4
3 0
0 1
1 3
0 2
2 3
1 2

output:

1
0
0
0
0
1

result:

wrong answer not correct