QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#751541 | #5659. Watching Cowflix | _8_8_ | 0 | 0ms | 3864kb | C++23 | 1.1kb | 2024-11-15 19:18:49 | 2024-11-15 19:18:49 |
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = (int)2e5 + 12, MOD = (int)1e9 + 7, b = 19;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, p[N];
int get(int v) {
if(p[v] == v) return v;
return p[v] = get(p[v]);
}
void test() {
n = 9;
cout << n << '\n';
for(int i = 1; i <= n; i++) {
p[i] = i;
int f = rng()%3;
if(f > 0) f = 0;
else f = 1;
if(i == 5) {
f = 1;
}
cout << f;
}
cout << '\n';
for(int i = 1; i <= n - 1; i++) {
int k = rng() % n + 1;
cout << k << ' ';
vector<int> f;
for(int j = 1; j <= n; j++) {
if(get(j) != get(k)) {
f.push_back(j);
}
}
int r = rng()%((int)f.size());
p[get(f[r])] = get(k);
cout << f[r] << '\n';
}
}
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1;
// cin >> t;
while(t--)
test();
}
详细
Pretests
Final Tests
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3620kb
input:
5 10001 1 2 2 3 3 4 4 5
output:
9 010010010 6 4 5 8 1 7 6 9 5 3 2 5 2 7 4 7
result:
wrong answer 1st numbers differ - expected: '4', found: '9'
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3688kb
input:
7 0001010 7 4 5 6 7 2 5 1 6 3 2 5
output:
9 110010101 4 1 2 9 8 2 9 1 7 5 6 4 5 2 4 3
result:
wrong answer 1st numbers differ - expected: '4', found: '9'
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3784kb
input:
5000 0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000010000000...
output:
9 110010001 4 9 2 3 8 1 1 4 9 5 1 6 4 3 4 7
result:
wrong answer 1st numbers differ - expected: '711', found: '9'
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 3784kb
input:
5000 0100000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000...
output:
9 000011100 3 9 9 2 2 8 2 1 8 7 2 4 7 6 1 5
result:
wrong answer 1st numbers differ - expected: '890', found: '9'
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 3660kb
input:
5000 0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000001000000000000000001000000000000000000000000000000000000000000000000...
output:
9 111010010 5 1 5 4 3 8 1 8 7 2 4 2 9 5 1 6
result:
wrong answer 1st numbers differ - expected: '794', found: '9'
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 3660kb
input:
200000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 000110000 7 3 3 1 2 9 1 5 8 6 2 7 3 4 8 1
result:
wrong answer 1st numbers differ - expected: '30804', found: '9'
Test #7:
score: 0
Wrong Answer
time: 0ms
memory: 3820kb
input:
200000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 000110111 6 2 6 4 9 3 5 7 1 9 8 5 3 7 7 4
result:
wrong answer 1st numbers differ - expected: '30644', found: '9'
Test #8:
score: 0
Wrong Answer
time: 0ms
memory: 3556kb
input:
200000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 010010011 8 2 8 4 9 4 6 1 8 5 9 3 7 5 2 1
result:
wrong answer 1st numbers differ - expected: '30736', found: '9'
Test #9:
score: 0
Wrong Answer
time: 0ms
memory: 3620kb
input:
100000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 000010010 1 8 2 7 4 8 9 8 5 7 6 4 3 9 6 5
result:
wrong answer 1st numbers differ - expected: '12231', found: '9'
Test #10:
score: 0
Wrong Answer
time: 0ms
memory: 3864kb
input:
100000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 000010110 2 1 3 1 7 1 8 6 8 2 2 5 6 9 6 4
result:
wrong answer 1st numbers differ - expected: '15993', found: '9'
Test #11:
score: 0
Wrong Answer
time: 0ms
memory: 3632kb
input:
100000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 010010110 4 6 3 8 8 1 1 2 7 1 7 5 8 9 1 4
result:
wrong answer 1st numbers differ - expected: '14608', found: '9'
Test #12:
score: 0
Wrong Answer
time: 0ms
memory: 3580kb
input:
100000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 001010010 3 6 8 6 4 1 3 2 8 5 1 9 8 9 2 7
result:
wrong answer 1st numbers differ - expected: '12198', found: '9'
Test #13:
score: 0
Wrong Answer
time: 0ms
memory: 3568kb
input:
100000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 110011100 6 5 5 2 2 9 6 8 3 4 4 5 6 7 5 1
result:
wrong answer 1st numbers differ - expected: '16072', found: '9'
Test #14:
score: 0
Wrong Answer
time: 0ms
memory: 3628kb
input:
100000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 101010100 7 6 4 1 1 5 9 2 4 6 4 8 4 3 7 2
result:
wrong answer 1st numbers differ - expected: '14721', found: '9'
Test #15:
score: 0
Wrong Answer
time: 0ms
memory: 3656kb
input:
100000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 000011110 8 1 7 2 9 1 3 8 1 2 6 4 5 2 8 6
result:
wrong answer 1st numbers differ - expected: '12121', found: '9'
Test #16:
score: 0
Wrong Answer
time: 0ms
memory: 3620kb
input:
100000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 101010000 1 5 2 1 4 7 5 6 3 2 9 8 2 7 4 9
result:
wrong answer 1st numbers differ - expected: '16192', found: '9'
Test #17:
score: 0
Wrong Answer
time: 0ms
memory: 3624kb
input:
100000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 100010110 5 2 9 7 5 4 5 9 1 7 1 6 1 3 5 8
result:
wrong answer 1st numbers differ - expected: '14705', found: '9'
Test #18:
score: 0
Wrong Answer
time: 0ms
memory: 3856kb
input:
100000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 100010100 2 7 1 4 6 1 4 7 3 2 2 9 2 8 9 5
result:
wrong answer 1st numbers differ - expected: '12282', found: '9'
Test #19:
score: 0
Wrong Answer
time: 0ms
memory: 3556kb
input:
100000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 001010010 1 5 1 8 9 2 1 7 2 5 5 4 8 3 9 6
result:
wrong answer 1st numbers differ - expected: '6', found: '9'
Test #20:
score: 0
Wrong Answer
time: 0ms
memory: 3624kb
input:
200000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 010010000 9 8 7 8 6 8 1 8 3 2 1 4 7 3 7 5
result:
wrong answer 1st numbers differ - expected: '32208', found: '9'
Test #21:
score: 0
Wrong Answer
time: 0ms
memory: 3620kb
input:
200000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 100010010 2 3 1 5 5 4 1 6 9 7 7 1 1 8 5 3
result:
wrong answer 1st numbers differ - expected: '29187', found: '9'
Test #22:
score: 0
Wrong Answer
time: 0ms
memory: 3852kb
input:
200000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 010010010 4 5 4 7 7 6 9 3 4 1 1 3 6 8 6 2
result:
wrong answer 1st numbers differ - expected: '24124', found: '9'
Test #23:
score: 0
Wrong Answer
time: 0ms
memory: 3624kb
input:
200000 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 010110001 4 7 8 4 8 2 6 9 9 8 3 2 4 1 6 5
result:
wrong answer 1st numbers differ - expected: '32229', found: '9'
Test #24:
score: 0
Wrong Answer
time: 0ms
memory: 3688kb
input:
200000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
9 100010100 2 6 5 6 5 7 3 2 7 4 1 2 7 8 3 9
result:
wrong answer 1st numbers differ - expected: '6', found: '9'