QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#188143 | #7236. Set intersection | ucup-team004 | WA | 0ms | 3808kb | C++20 | 1.1kb | 2023-09-25 15:39:00 | 2023-09-25 15:39:01 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
std::cin >> n;
std::vector<std::bitset<12000>> s(n + 1);
std::vector<int> cnt(2 * n);
for (int i = 0; i < n + 1; i++) {
std::string a;
std::cin >> a;
for (int j = 0; j < a.size(); j++) {
for (int k = 0; k < 6 && j * 6 + k < 2 * n; k++) {
s[i][j * 6 + k] = (a[j] - 33) >> k & 1;
}
}
for (int j = 0; j < 2 * n; j++) {
cnt[s[i][j]]++;
}
}
for (int i = 0; i < n + 1; i++) {
int sum = 0;
for (int j = 0; j < 2 * n; j++) {
sum += s[i][j] ? n + 1 - cnt[j] : cnt[j];
}
if (sum < (n - 1) * (n + 2)) {
for (int j = 0; j < n + 1; j++) {
if (i != j && (s[i] ^ s[j]).count() <= n) {
std::cout << i + 1 << " " << j + 1 << "\n";
return 0;
}
}
}
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3808kb
input:
4 7" *$ D# M" ;"
output:
3 2
result:
ok OK (n = 3, i = 3, j = 2, intersection = 2)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3620kb
input:
10 EVK# IH=# 676" R7,# 74S" 6V2# O3J# S-7$ NU5" C[$$ 3N.#
output:
result:
wrong output format Unexpected end of file - int32 expected