QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#270333 | #5499. Aliases | pooty# | WA | 228ms | 5156kb | C++14 | 1.6kb | 2023-11-30 19:11:02 | 2023-11-30 19:11:03 |
Judging History
answer
#ifdef MY_LOCAL
#include "D://competitive_programming/debug/debug.h"
#define debug(x) cerr << "[" << #x<< "]:"<<x<<"\n"
#else
#define debug(x)
#endif
#define REP(i, n) for(int i = 0; i < (n); i ++)
#define REPL(i,m, n) for(int i = (m); i < (n); i ++)
#define SORT(arr) sort(arr.begin(), arr.end())
#define LSOne(S) ((S)&-(S))
#define sz(X) ((int)X.size())
#define READ(arr) for(auto &a: arr){cin>>a;}
#define SUM(arr) accumulate((arr).begin(), (arr).end(), 0LL)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef tree<int,null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ost;
const ll INF = 1e18;
void solve() {
int n;cin>>n;
vector<pair<string, string>> vec(n);
REP(i, n) {
string a,b;cin>>a>>b;
vec[i] = {a,b};
}
int bst = INF;
tuple<int,int,int> ans;
REP(a, 7) {
REP(b, 7) {
map<string, int> cter;
int mx = 0;
for (auto [x,y]: vec) {
string rr = x.substr(0, a) + y.substr(0, b);
cter[rr]++;
mx = max(cter[rr], mx);
}
int needed = 0;
int tot = 1;
while (tot < mx) {
tot *= 10;
needed++;
}
if (a + b + needed < bst) {
ans = {a,b,needed};
bst = a + b + needed;
}
}
}
auto [a,b,c] = ans;
cout<<a<<" "<<b<<" "<<c<<"\n";
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tc;
cin>>tc;
REP(i, tc) {
solve();
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3468kb
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 2
result:
ok correct! (1 test case)
Test #2:
score: -100
Wrong Answer
time: 228ms
memory: 5156kb
input:
6 1 g u 14643 gj ek hc bi hi ke ab ij hk cj ha bi ag fe eb ej hd ei bf gj ke dd ib jd id jb gd ei cj bi bi hg ic dh ke gk af eg fg dd fe fa be ge hf kj ih ci gg jf ed dd eh gi cc kd ka fd af gb ka fe ja ed bc hi eg cf gg ff kf gf ii ch hh ec ei ec cd gc bh hb dd id ce bk ib ic bf kk gh cd hb he if g...
output:
0 0 0 0 0 5 0 1 1 1 0 2 1 1 1 2 0 1
result:
wrong answer Loginy nie moga byc puste! (test case 1)