QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#333794#1148. GameDimash15 25ms101976kbC++201.2kb2024-02-20 16:09:062024-02-20 16:09:06

Judging History

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

  • [2024-02-20 16:09:06]
  • 评测
  • 测评结果:15
  • 用时:25ms
  • 内存:101976kb
  • [2024-02-20 16:09:06]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
const int N = 2e6 + 12, MOD = 998244353;

typedef long long ll;

#include "game.h"
int _n;
//int read_int() {
//    int x;
//    assert(scanf("%d", &x) == 1);
//    return x;
//}
set<int> g[N];
int p[N],sz[N];
void initialize(int n) {
    _n = n;
    for(int i = 0;i < n;i++){
        p[i] = i;
        sz[i] = 1;
    }
    for(int i = 0;i < n;i++){
        p[i] = i;
        for(int j = 0;j < n;j++){
            g[i].insert(j);
        }
    }
}
int col[2002][2002];
int get(int v){
    if(p[v] == v) return v;
    return p[v] = get(p[v]);
}
void merge(int a,int b){
    a = get(a);
    b = get(b);
    p[a] = b;
    sz[b] += sz[a];
}
int hasEdge(int u, int v) {
    u = get(u);
    v = get(v);
    if (u == v) return 1;
    if(u > v) swap(u,v);
    col[u][v]++;
    if(col[u][v] == sz[u] * sz[v]){
        merge(u,v);
        return 1;
    }
    return 0;
}
//int main() {
//    int n, u, v;
//    n = read_int();
//    initialize(n);
//    for (int i = 0; i < n * (n - 1) / 2; i++) {
//        u = read_int();
//        v = read_int();
//        if (hasEdge(u, v)) {
//            puts("1");
//        }
//        else puts("0");
//    }
//    return 0;
//}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 15
Accepted

Test #1:

score: 15
Accepted
time: 12ms
memory: 97664kb

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: 12ms
memory: 98392kb

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: 12ms
memory: 99300kb

input:

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

output:

1
0
0
1
0
1

result:

ok correct

Test #4:

score: 0
Accepted
time: 24ms
memory: 98952kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #5:

score: 0
Accepted
time: 11ms
memory: 97968kb

input:

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

output:

1
0
0
1
0
1

result:

ok correct

Test #6:

score: 0
Accepted
time: 7ms
memory: 97860kb

input:

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

output:

1
0
0
1
0
1

result:

ok correct

Test #7:

score: 0
Accepted
time: 19ms
memory: 98464kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #8:

score: 0
Accepted
time: 23ms
memory: 101976kb

input:

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

output:

1
0
1
0
0
0

result:

ok correct

Test #9:

score: 0
Accepted
time: 8ms
memory: 99424kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #10:

score: 0
Accepted
time: 25ms
memory: 98916kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #11:

score: 0
Accepted
time: 12ms
memory: 99564kb

input:

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

output:

1
0
0
1
0
1

result:

ok correct

Test #12:

score: 0
Accepted
time: 20ms
memory: 97920kb

input:

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

output:

1
1
0
0
0
1

result:

ok correct

Test #13:

score: 0
Accepted
time: 20ms
memory: 98272kb

input:

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

output:

1
0
0
1
0
0

result:

ok correct

Test #14:

score: 0
Accepted
time: 3ms
memory: 98112kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #15:

score: 0
Accepted
time: 11ms
memory: 98520kb

input:

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

output:

1
0
0
1
0
0

result:

ok correct

Test #16:

score: 0
Accepted
time: 3ms
memory: 97692kb

input:

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

output:

1
0
0
1
0
0

result:

ok correct

Test #17:

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

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #18:

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

input:

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

output:

1
0
0
1
0
0

result:

ok correct

Test #19:

score: 0
Accepted
time: 11ms
memory: 97968kb

input:

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

output:

1
1
0
0
0
1

result:

ok correct

Test #20:

score: 0
Accepted
time: 13ms
memory: 99420kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #21:

score: 0
Accepted
time: 17ms
memory: 98760kb

input:

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

output:

1
1
0
0
0
1

result:

ok correct

Test #22:

score: 0
Accepted
time: 8ms
memory: 99368kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #23:

score: 0
Accepted
time: 10ms
memory: 99276kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #24:

score: 0
Accepted
time: 8ms
memory: 97608kb

input:

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

output:

1
1
0
0
0
1

result:

ok correct

Subtask #2:

score: 0
Wrong Answer

Test #25:

score: 27
Accepted
time: 7ms
memory: 97520kb

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: 19ms
memory: 99452kb

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: 7ms
memory: 97804kb

input:

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

output:

1
0
0
1
0
1

result:

ok correct

Test #28:

score: 0
Accepted
time: 12ms
memory: 99508kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #29:

score: 0
Accepted
time: 8ms
memory: 98124kb

input:

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

output:

1
0
0
1
0
1

result:

ok correct

Test #30:

score: 0
Accepted
time: 10ms
memory: 98744kb

input:

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

output:

1
0
0
1
0
1

result:

ok correct

Test #31:

score: 0
Accepted
time: 11ms
memory: 97780kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #32:

score: 0
Accepted
time: 19ms
memory: 98044kb

input:

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

output:

1
0
1
0
0
0

result:

ok correct

Test #33:

score: 0
Accepted
time: 11ms
memory: 98856kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #34:

score: 0
Accepted
time: 8ms
memory: 98484kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #35:

score: 0
Accepted
time: 11ms
memory: 99384kb

input:

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

output:

1
0
0
1
0
1

result:

ok correct

Test #36:

score: 0
Accepted
time: 11ms
memory: 98168kb

input:

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

output:

1
1
0
0
0
1

result:

ok correct

Test #37:

score: 0
Accepted
time: 7ms
memory: 97652kb

input:

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

output:

1
0
0
1
0
0

result:

ok correct

Test #38:

score: 0
Accepted
time: 8ms
memory: 99160kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #39:

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

input:

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

output:

1
0
0
1
0
0

result:

ok correct

Test #40:

score: 0
Accepted
time: 8ms
memory: 97900kb

input:

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

output:

1
0
0
1
0
0

result:

ok correct

Test #41:

score: 0
Accepted
time: 8ms
memory: 97520kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #42:

score: 0
Accepted
time: 18ms
memory: 98112kb

input:

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

output:

1
0
0
1
0
0

result:

ok correct

Test #43:

score: 0
Accepted
time: 7ms
memory: 98076kb

input:

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

output:

1
1
0
0
0
1

result:

ok correct

Test #44:

score: 0
Accepted
time: 7ms
memory: 98608kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #45:

score: 0
Accepted
time: 11ms
memory: 97896kb

input:

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

output:

1
1
0
0
0
1

result:

ok correct

Test #46:

score: 0
Accepted
time: 14ms
memory: 98616kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #47:

score: 0
Accepted
time: 12ms
memory: 98204kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #48:

score: 0
Accepted
time: 8ms
memory: 98536kb

input:

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

output:

1
1
0
0
0
1

result:

ok correct

Test #49:

score: -27
Wrong Answer
time: 11ms
memory: 99348kb

input:

33
21 3
10 26
0 12
2 9
14 7
28 21
0 18
10 29
20 5
26 13
26 3
12 17
19 14
0 3
19 29
17 10
25 16
16 15
9 5
3 27
4 26
12 24
17 30
4 16
21 14
6 22
0 28
11 10
15 3
7 18
13 28
18 23
9 31
24 10
21 16
25 3
17 13
23 17
31 6
16 10
6 2
32 7
16 31
2 19
9 17
32 5
3 17
1 0
12 23
28 9
19 32
5 21
5 19
13 1
32 15
32...

output:

1
1
1
1
1
0
0
0
1
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer not correct

Subtask #3:

score: 0
Wrong Answer

Test #79:

score: 58
Accepted
time: 19ms
memory: 97708kb

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: 15ms
memory: 97652kb

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: 7ms
memory: 97868kb

input:

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

output:

1
0
0
1
0
1

result:

ok correct

Test #82:

score: 0
Accepted
time: 7ms
memory: 99500kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #83:

score: 0
Accepted
time: 25ms
memory: 98172kb

input:

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

output:

1
0
0
1
0
1

result:

ok correct

Test #84:

score: 0
Accepted
time: 8ms
memory: 98380kb

input:

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

output:

1
0
0
1
0
1

result:

ok correct

Test #85:

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

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #86:

score: 0
Accepted
time: 7ms
memory: 97652kb

input:

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

output:

1
0
1
0
0
0

result:

ok correct

Test #87:

score: 0
Accepted
time: 20ms
memory: 98092kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #88:

score: 0
Accepted
time: 16ms
memory: 97584kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #89:

score: 0
Accepted
time: 20ms
memory: 99200kb

input:

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

output:

1
0
0
1
0
1

result:

ok correct

Test #90:

score: 0
Accepted
time: 8ms
memory: 98792kb

input:

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

output:

1
1
0
0
0
1

result:

ok correct

Test #91:

score: 0
Accepted
time: 16ms
memory: 97484kb

input:

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

output:

1
0
0
1
0
0

result:

ok correct

Test #92:

score: 0
Accepted
time: 22ms
memory: 99232kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #93:

score: 0
Accepted
time: 20ms
memory: 98696kb

input:

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

output:

1
0
0
1
0
0

result:

ok correct

Test #94:

score: 0
Accepted
time: 16ms
memory: 97780kb

input:

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

output:

1
0
0
1
0
0

result:

ok correct

Test #95:

score: 0
Accepted
time: 23ms
memory: 98488kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #96:

score: 0
Accepted
time: 17ms
memory: 98476kb

input:

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

output:

1
0
0
1
0
0

result:

ok correct

Test #97:

score: 0
Accepted
time: 7ms
memory: 98152kb

input:

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

output:

1
1
0
0
0
1

result:

ok correct

Test #98:

score: 0
Accepted
time: 7ms
memory: 98272kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #99:

score: 0
Accepted
time: 12ms
memory: 98368kb

input:

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

output:

1
1
0
0
0
1

result:

ok correct

Test #100:

score: 0
Accepted
time: 8ms
memory: 98012kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #101:

score: 0
Accepted
time: 8ms
memory: 97924kb

input:

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

output:

1
0
1
0
0
1

result:

ok correct

Test #102:

score: 0
Accepted
time: 12ms
memory: 97520kb

input:

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

output:

1
1
0
0
0
1

result:

ok correct

Test #103:

score: -58
Wrong Answer
time: 15ms
memory: 98416kb

input:

33
21 3
10 26
0 12
2 9
14 7
28 21
0 18
10 29
20 5
26 13
26 3
12 17
19 14
0 3
19 29
17 10
25 16
16 15
9 5
3 27
4 26
12 24
17 30
4 16
21 14
6 22
0 28
11 10
15 3
7 18
13 28
18 23
9 31
24 10
21 16
25 3
17 13
23 17
31 6
16 10
6 2
32 7
16 31
2 19
9 17
32 5
3 17
1 0
12 23
28 9
19 32
5 21
5 19
13 1
32 15
32...

output:

1
1
1
1
1
0
0
0
1
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer not correct