QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#111664 | #5499. Aliases | xaphoenix# | WA | 2ms | 3448kb | C++17 | 1.8kb | 2023-06-07 20:35:10 | 2023-06-07 20:35:16 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define LC ch[k][0]
#define RC ch[k][1]
#define IO cin.sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define rep(i,a,n) for (int i = a; i < n; i++)
#define repn(i,a,n) for (int i = a; i <= n; i++)
#define per(i,a,n) for (int i = n - 1; i >= a; i--)
#define pern(i,a,n) for (int i = n; i >= a; i--)
typedef long long LL;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
const int N = 100010;
const int M = 610000;
const int mod = 1e9+7;
const int inf = (int)1e9;
const LL INF = (LL)1e18;
const double eps = 1e-9;
int n, tp[8];
vector<pair<string, string>> s;
map<string, int> m;
//hash<string> f;
void solve() {
cin >> n;
string s1, s2;
s.clear();
repn(i, 1, n) {
cin >> s1 >> s2;
s.pb(mp(s1, s2));
}
int ans = 7, ai = 0, aj = 0, ak = 7;
repn(i, 0, 6) {
repn(j, 0, 6 - i) {
repn(k, 0, 6 - i - j) {
if (i + j + k == 0) continue;
m.clear();
int mx = 0;
rep(id, 0, n) {
string cur = "";
string tmp = s[id].fi;
cur += tmp.substr(0, min(i, (int)tmp.length()));
tmp = s[id].se;
cur += tmp.substr(0, min(j, (int)tmp.length()));
cout << cur << "\n";
if ((int)cur.length() == 0) cur = "1";
//ull cid = f(cur);
m[cur] ++;
mx = max(mx, m[cur]);
}
if (mx <= tp[k]) {
if (ans > i + j + k) {
ans = min(ans, i + j + k);
ai = i; aj = j; ak = k;
}
}
}
}
}
cout << ai << " " << aj << " " << ak << "\n";
}
int main()
{
IO;
tp[0] = 1;
repn(i, 1, 7) tp[i] = tp[i - 1] * 10;
int T;
cin >> T;
repn(i, 1, T) solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3448kb
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:
e s s e e s b b b o t e s s e e s b b b o t e s s e e s b b b o t e s s e e s b b b o t e s s e e s b b b o t e s s e e s b b b o t er sv sv er er sv bj bj bj od th er sv sv er er sv bj bj bj od th er sv sv er er sv bj bj bj od th er ...
result:
wrong output format Expected integer, but "e" found (test case 1)