QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#105336 | #5499. Aliases | cciafrino# | WA | 0ms | 3672kb | C++17 | 1.5kb | 2023-05-13 22:24:32 | 2023-05-13 22:24:33 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int T; cin >> T;
while (T--) {
int N; cin >> N;
vector<array<string, 2>> S(N);
for (auto& [n, s] : S) {
cin >> n >> s;
}
vector<int> pw(10);
pw[0] = 1;
for (int i = 1; i < 10; ++i) {
pw[i] = pw[i - 1] * 10;
}
map<string, int> freq;
array<int, 3> ans = {0, 0, 0};
int cur_sum = 100000000;
for (int a = 0; a < 7; ++a) {
for (int b = 0; b < 7; ++b) {
for (int c = 0; c < 7; ++c) {
if (a+b+c == 0 || a+b+c > 6) continue;
for (int i = 0; i < N; ++i) {
string P = S[i][0].substr(0, a) + S[i][1].substr(0, b);
freq[P] += 1;
}
bool is_ok = true;
for (auto& [s, val] : freq) {
int dig = log10(val);
if (dig > c) {
is_ok = false;
}
}
if (!is_ok) continue;
if (a+b+c < cur_sum) {
ans = {a, b, c};
cur_sum = a+b+c;
}
}
}
}
cout << ans[0] << ' ' << ans[1] << ' ' << ans[2] << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3672kb
input:
1 11 sven eriksson erik svensson sven svensson erik eriksson bjorn eriksson bjorn svensson bjorn bjornsson erik bjornsson sven bjornsson thor odinsson odin thorsson
output:
0 0 1
result:
wrong answer Loginy nieunikalne! (test case 1)