QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#121686#1148. Gamevalerikk#0 0ms3808kbC++17451b2023-07-08 17:48:112024-07-04 00:31:45

Judging History

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

  • [2024-07-04 00:31:45]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3808kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-08 17:48:11]
  • 提交

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;
}

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: 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