QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#876460#370. Cityduongnc0000 60ms4736kbC++201.2kb2025-01-30 21:29:582025-01-30 21:30:05

Judging History

This is the latest submission verdict.

  • [2025-01-30 21:30:05]
  • Judged
  • Verdict: 0
  • Time: 60ms
  • Memory: 4736kb
  • [2025-01-30 21:29:58]
  • Submitted

Encoder

#include "Encoder.h"
#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define i64 long long
#define isz(x) (int)x.size()
using namespace std;

void Encode(int N, int A[], int B[]) {
	vector<vector<int>> g(N);
	for (int i = 0; i < N - 1; ++i) {
		int u = A[i], v = B[i];
		g[u].emplace_back(v);
		g[v].emplace_back(u);
	}
	int tdfs = 0;
	vector<i64> tin(N), tout(N);
	auto dfs = [&](auto self, int u, int p) -> void {
		tin[u] = tdfs++;
		for (auto v : g[u]) if (v != p) {
			self(self, v, u);
		}
		tout[u] = tdfs;
		assert(tout[u] < 1 << 18);
	};
	dfs(dfs, 0, -1);
	for (int i = 0; i < N; ++i) Code(i, tin[i] * ((1ll << 18) - 1) + tout[i]);
}

Device

#include "Device.h"
#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define i64 long long
#define isz(x) (int)x.size()
using namespace std;

void InitDevice() {
}

const int lim = (1 << 18) - 1;

int Answer(i64 S, i64 T) {
	int Sl = S >> 18, Sr = S & lim;
	int Tl = T >> 18, Tr = T & lim;
	if (Tl <= Sl and Sr <= Tr) return 0;
	if (Sl <= Tl and Tr <= Sr) return 1;
	return 2;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3840kb

input:

10 45
0 5
0 2
4 3
6 4
0 6
2 8
6 9
2 1
5 7
5 0
0 2
8 0
0 7
0 6
1 0
4 0
0 3
0 9
5 2
5 8
7 5
5 6
1 5
4 5
5 3
9 5
8 2
7 2
2 6
2 1
2 4
3 2
2 9
7 8
6 8
8 1
8 4
3 8
9 8
6 7
1 7
4 7
3 7
9 7
1 6
6 4
6 3
6 9
4 1
1 3
9 1
3 4
9 4
9 3

output:

10 1310721 786435 2097153 1835010 262146 1572868 524289 1048577 2359297 

input:

Interaction has been finished!

output:

0
1
0
1
1
0
0
1
1
2
1
0
2
0
0
1
0
0
2
2
1
1
0
1
1
2
1
2
0
0
2
0
2
0
0
2
1
1
1
2
1
0
0
0
0
2359297

result:

wrong answer Wrong Answer [6] (Query #11 returned 1 but expected 2)

Subtask #2:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 60ms
memory: 4736kb

input:

700 244650
407 643
680 336
573 208
466 455
159 648
575 549
50 567
251 211
211 481
530 513
136 334
112 492
175 396
643 483
265 132
20 160
174 550
251 90
99 236
579 374
670 613
495 379
251 170
652 61
495 467
27 317
202 484
420 592
542 354
565 650
35 88
216 681
277 219
299 171
220 647
418 433
434 660
2...

output:

700 123994114 147062785 50331649 168558594 94109699 175112194 129761281 115343361 181403649 154402819 124780545 70778881 8126466 169607169 148635650 89915393 164626434 164888577 42205185 113246212 75497495 64225281 95158273 112459777 102236161 33292289 5767171 2097153 179306497 43778050 153616385 16...

input:

Interaction has been finished!

output:

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

result:

wrong answer Wrong Answer [6] (Query #702 returned 1 but expected 2)