QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#283934 | #7879. Colorful Balloons | ContrisElikemouthing# | WA | 8ms | 10516kb | C++17 | 991b | 2023-12-15 18:55:31 | 2023-12-15 18:55:32 |
Judging History
answer
#include <bits/stdc++.h>
#define eb emplace_back
#define pb pop_back
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef tuple<int, int, int> tu;
bool Mbe;
const int N = 1e5 + 100;
int n, ct, c[N];
string s[N], p[N];
map<string, int> id;
void solve() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> s[i];
if (!id[s[i]]) p[id[s[i]] = ++ct] = s[i];
c[id[s[i]]]++;
}
for (int i = 1; i <= ct; i++) {
if (c[i] >= (n + 1) / 2) {
cout << p[i] << '\n';
return;
}
}
cout << "uh-oh" << '\n';
}
bool Med;
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cerr << (&Mbe - &Med) / 1048576.0 << " MB\n";
#ifdef FILE
freopen("1.in", "r", stdin);
freopen("1.out", "w", stdout);
#endif
int T = 1;
// cin >> T;
while (T--) solve();
cerr << (int)(1e3 * clock() / CLOCKS_PER_SEC) << " ms\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 10072kb
input:
5 red green red red blue
output:
red
result:
ok "red"
Test #2:
score: 0
Accepted
time: 0ms
memory: 10516kb
input:
3 red blue yellow
output:
uh-oh
result:
ok "uh-oh"
Test #3:
score: 0
Accepted
time: 0ms
memory: 10052kb
input:
1 abc
output:
abc
result:
ok "abc"
Test #4:
score: 0
Accepted
time: 8ms
memory: 10052kb
input:
100000 vagsmrnnry vagsmrnnry bvaojtyvmn vagsmrnnry vagsmrnnry vvzrbrqrgb vagsmrnnry vvzrbrqrgb vagsmrnnry vagsmrnnry bvaojtyvmn vagsmrnnry vagsmrnnry vvzrbrqrgb vagsmrnnry bvaojtyvmn vagsmrnnry vagsmrnnry vagsmrnnry vvzrbrqrgb vagsmrnnry vvzrbrqrgb vagsmrnnry vagsmrnnry vagsmrnnry vagsmrnnry vagsmrn...
output:
vagsmrnnry
result:
ok "vagsmrnnry"
Test #5:
score: -100
Wrong Answer
time: 8ms
memory: 10056kb
input:
100000 khccohwxsc aakazkvryg khccohwxsc aakazkvryg khccohwxsc khccohwxsc aakazkvryg aakazkvryg khccohwxsc djckwpxwyt khccohwxsc khccohwxsc djckwpxwyt khccohwxsc aakazkvryg djckwpxwyt djckwpxwyt djckwpxwyt aakazkvryg djckwpxwyt aakazkvryg aakazkvryg khccohwxsc aakazkvryg khccohwxsc aakazkvryg aakazkv...
output:
aakazkvryg
result:
wrong answer 1st words differ - expected: 'uh-oh', found: 'aakazkvryg'