Submission #12894206
Source Code Expand
Copy
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #define all(x) (x).begin(),(x).end() //#pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60; template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } //--------------------------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------------------------- ∧_∧ ∧_∧ (´<_` ) Welcome to My Coding Space! ( ´_ゝ`) / ⌒i @hamayanhamayan0 / \ | | / / ̄ ̄ ̄ ̄/ | __(__ニつ/ _/ .| .|____ \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ string S; int cnt[3]; //--------------------------------------------------------------------------------------------------- void _main() { cin >> S; fore(c, S) cnt[c - 'a']++; int ma = -1; rep(i, 0, 3) chmax(ma, cnt[i]); rep(i, 0, 3) if (ma == cnt[i]) cout << char('a' + i) << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - Plurality Voting |
User | hamayanhamayan |
Language | C++ (GCC 9.2.1) |
Score | 8 |
Code Size | 1589 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 3684 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 8 / 8 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 0.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, s1.txt, s2.txt, s3.txt, s4.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0.txt | AC | 3 ms | 3684 KB |
1.txt | AC | 2 ms | 3628 KB |
10.txt | AC | 2 ms | 3608 KB |
11.txt | AC | 2 ms | 3560 KB |
12.txt | AC | 2 ms | 3504 KB |
13.txt | AC | 2 ms | 3584 KB |
14.txt | AC | 2 ms | 3532 KB |
15.txt | AC | 2 ms | 3532 KB |
16.txt | AC | 2 ms | 3628 KB |
17.txt | AC | 2 ms | 3668 KB |
18.txt | AC | 2 ms | 3628 KB |
19.txt | AC | 2 ms | 3508 KB |
2.txt | AC | 2 ms | 3508 KB |
3.txt | AC | 2 ms | 3548 KB |
4.txt | AC | 2 ms | 3556 KB |
5.txt | AC | 2 ms | 3584 KB |
6.txt | AC | 2 ms | 3536 KB |
7.txt | AC | 2 ms | 3596 KB |
8.txt | AC | 2 ms | 3556 KB |
9.txt | AC | 2 ms | 3488 KB |
s1.txt | AC | 2 ms | 3616 KB |
s2.txt | AC | 2 ms | 3536 KB |
s3.txt | AC | 2 ms | 3596 KB |
s4.txt | AC | 2 ms | 3488 KB |