QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#121686 | #1148. Game | valerikk# | 0 | 0ms | 3808kb | C++17 | 451b | 2023-07-08 17:48:11 | 2024-07-04 00:31:45 |
Judging History
answer
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
const int N = 1505;
int p[N];
int cnt;
int get(int v) {
return p[v] == v ? v : p[v] = get(p[v]);
}
void merge(int v, int u) {
v = get(v);
u = get(u);
if (v != u) {
--cnt;
p[v] = u;
}
}
}
void initialize(int n) {
for (int i = 0; i < n; ++i) {
p[i] = i;
}
cnt = n;
}
int hasEdge(int u, int v) {
if (cnt > 2) {
merge(v, u);
return 1;
}
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 15
Accepted
time: 0ms
memory: 3740kb
input:
4 0 1 3 0 1 2 0 2 3 1 2 3
output:
1 1 0 0 0 0
result:
ok correct
Test #2:
score: -15
Wrong Answer
time: 0ms
memory: 3684kb
input:
4 0 3 2 0 0 1 1 2 1 3 2 3
output:
1 1 0 0 0 0
result:
wrong answer not correct
Subtask #2:
score: 0
Wrong Answer
Test #25:
score: 27
Accepted
time: 0ms
memory: 3808kb
input:
4 0 1 3 0 1 2 0 2 3 1 2 3
output:
1 1 0 0 0 0
result:
ok correct
Test #26:
score: -27
Wrong Answer
time: 0ms
memory: 3756kb
input:
4 0 3 2 0 0 1 1 2 1 3 2 3
output:
1 1 0 0 0 0
result:
wrong answer not correct
Subtask #3:
score: 0
Wrong Answer
Test #79:
score: 58
Accepted
time: 0ms
memory: 3680kb
input:
4 0 1 3 0 1 2 0 2 3 1 2 3
output:
1 1 0 0 0 0
result:
ok correct
Test #80:
score: -58
Wrong Answer
time: 0ms
memory: 3808kb
input:
4 0 3 2 0 0 1 1 2 1 3 2 3
output:
1 1 0 0 0 0
result:
wrong answer not correct