QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#131215 | #5499. Aliases | hano | WA | 103ms | 17104kb | C++14 | 1.0kb | 2023-07-26 18:39:23 | 2023-07-26 18:39:25 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 200005;
string x[N], y[N];
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>x[i]>>y[i];
}
//int cnt = 0;
for(int ans=1;ans<=6;++ans){
for(int a=0;a<=ans;++a){
for(int b=0;b<=ans-a;++b){
int c = ans - a - b;
//cnt++;
map<string,int> mp;
bool flag = false;
for(int i=0;i<n;i++){
string tmp = "";
for(int j=0;j<min(a,(int)x[i].length());j++){
tmp.push_back(x[i][j]);
}
for(int j=0;j<min(b,(int)y[i].length());j++){
tmp.push_back(y[i][j]);
}
if(mp.count(tmp)) mp[tmp]++;
else mp[tmp] = 1;
if(mp[tmp] > c*10 + (c==0)){
flag = true;
}
}
if(flag){
continue;
}else{
cout<<a<<" "<<b<<" "<<c<<endl;
ans = 10;
a = 10;
b = 10;
}
}
}
}
//cout<<cnt<<endl;
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 15960kb
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: 103ms
memory: 17104kb
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 1 1 2 2 0 1 1 0 2 2 1 1 1 2 0 1
result:
wrong answer Rozwiazanie nieoptymalne! (test case 4)