QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#249528#5499. AliasesreginoxWA 0ms16292kbC++201.2kb2023-11-12 11:28:452023-11-12 11:28:45

Judging History

你现在查看的是最新测评结果

  • [2023-11-12 11:28:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:16292kb
  • [2023-11-12 11:28:45]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define sp << " "
#define task ""
using namespace std;
ll t, n, aa=1e9, bb=1e9, cc=1e9, pw[10]={1};
pair<string, string> s[200005];
map<pair<string,string>,ll> mp;

bool check(ll a, ll b, ll c){
	mp.clear();
	for(ll i = 1; i <= n; i++){
		mp[make_pair(s[i].first.substr(0,min(a, (ll)s[i].first.size())),s[i].second.substr(min(b, (ll)s[i].second.size())))]++;
	}
	for(auto x:mp){
		if(x.second>pw[c]-1) return false;
	}
	return true;
}

int main(){
	if(fopen(task".inp","r")){
		freopen(task".inp","r",stdin);
		freopen(task".out","w",stdout);
	}
	faster
	for(ll i = 1; i <= 9; i++) pw[i]=pw[i-1]*10;
	pw[0]=2;
	cin >> t;
	while(t--){
		aa=1e9, bb=1e9, cc=1e9;
		cin >> n;
		for(ll i = 1; i <= n; i++) cin >> s[i].first >> s[i].second;
		for(ll a = 0; a <= 6; a++){
			for(ll b = 0; b <= 6; b++){
				for(ll c = 0; c <= 6; c++){	
					if(a+b+c<1) continue;
					if(a+b+c>6) continue;
					if(check(a, b, c)){
						if(a+b+c<aa+bb+cc){
							aa=a,bb=b,cc=c;
						}
					}
				}
			}
		}
		cout << aa sp << bb sp << cc << "\n";
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 16292kb

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)