QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#278174 | #7882. Linguistics Puzzle | daredsakura# | WA | 1ms | 3588kb | C++14 | 644b | 2023-12-07 13:24:32 | 2023-12-07 13:24:32 |
Judging History
answer
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
void solve() {
int n;
cin >> n;
map<string, int> cnt;
string s;
for (int i = 0; i < n; ++i) {
cin >> s;
cnt[s]++;
}
string ans;
for (auto &[k, v]: cnt) {
if (v * 2 > n) {
ans = k;
break;
}
}
if (ans.empty())
ans = "uh-oh";
cout << ans << '\n';
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t = 1;
// cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3588kb
input:
2 3 a b a b b b b c cc 4 d d d d d c b a d b cd cb d a cb bc
output:
uh-oh
result:
wrong answer invalid length at case #1