QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#77273 | #5501. Ctrl+C Ctrl+V | nweeks | WA | 0ms | 3340kb | C++17 | 1.5kb | 2023-02-13 21:16:21 | 2023-02-13 21:19:01 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
string to_string(string s) { return s; }
template <typename T> string to_string(T v) {
bool first = true;
string res = "[";
for (const auto &x : v) {
if (!first)
res += ", ";
first = false;
res += to_string(x);
}
res += "]";
return res;
}
void dbg_out() { cout << endl; }
template <typename Head, typename... Tail> void dbg_out(Head H, Tail... T) {
cout << ' ' << to_string(H);
dbg_out(T...);
}
#ifdef DEBUG
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif
void solve() {
int N;
cin >> N;
vector<pair<string, string>> names(N);
for (auto &[s, t] : names)
cin >> s >> t;
int solA = 1e18, solB = 1e18, solC = 1e18;
for (int a = 0; a <= 6; ++a)
for (int b = 0; b <= 6 - a; ++b) {
map<string, int> cnt;
for (auto &[s, t] : names) {
cnt[s.substr(0, a) + t.substr(0, b)]++;
}
int c = a + b == 0;
int maxAllowed = c == 0 ? 1 : 10;
for (auto &[s, x] : cnt) {
while (maxAllowed < x)
c++, maxAllowed *= 10;
}
if (solA + solB + solC > a + b + c)
solA = a, solB = b, solC = c;
}
cout << solA << ' ' << solB << ' ' << solC << '\n';
}
signed main(void) {
ios_base::sync_with_stdio(false);
cin.tie(0);
int nbTests;
cin >> nbTests;
for (int iTest(0); iTest < nbTests; ++iTest)
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3340kb
input:
3 aniasieurodzilaapotemnicsieniedzialo nicciekawegouanianiagnieszkianialicji jeszczekrotszaautobiografiaani
output:
0 0 1 0 0 1 0 0 1
result:
wrong answer 1st lines differ - expected: '1', found: '0 0 1'