Submission #49710862
Source Code Expand
Copy
#include <bits/stdc++.h>#define ll long long#define pb push_back#define ff first#define ss second#pragma GCC optimize("O3,unroll-loops")#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")using namespace std;static const bool __boost = [](){cin.tie(0);cout.tie(0);return ios_base::sync_with_stdio(0);}();const int N = 2e5 + 5;int main(){__boost;string s;cin >> s;map<char, int> mp;
#include <bits/stdc++.h> #define ll long long #define pb push_back #define ff first #define ss second #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") using namespace std; static const bool __boost = [](){ cin.tie(0); cout.tie(0); return ios_base::sync_with_stdio(0); }(); const int N = 2e5 + 5; int main(){ __boost; string s; cin >> s; map<char, int> mp; for(auto c:s){ mp[c] ++; } char best=s[0]; for(auto c:s){ if(mp[c] > mp[best] or (mp[c] == mp[best] && c < best)){ best = c; } } cout << best; }
Submission Info
Submission Time | |
---|---|
Task | B - Frequency |
User | elac |
Language | C++ 20 (gcc 12.2) |
Score | 200 |
Code Size | 625 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 3564 KB |
Compile Error
Main.cpp: In function ‘int main()’: Main.cpp:18:9: warning: statement has no effect [-Wunused-value] 18 | __boost; | ^~~~~~~
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 01-sample.txt, 02-sample.txt, 03-sample.txt |
All | 01-sample.txt, 02-sample.txt, 03-sample.txt, 04-hidden.txt, 05-hidden.txt, 06-hidden.txt, 07-hidden.txt, 08-hidden.txt, 09-hidden.txt, 10-hidden.txt, 11-hidden.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-sample.txt | AC | 1 ms | 3492 KB |
02-sample.txt | AC | 1 ms | 3496 KB |
03-sample.txt | AC | 1 ms | 3492 KB |
04-hidden.txt | AC | 1 ms | 3556 KB |
05-hidden.txt | AC | 1 ms | 3476 KB |
06-hidden.txt | AC | 1 ms | 3564 KB |
07-hidden.txt | AC | 1 ms | 3500 KB |
08-hidden.txt | AC | 1 ms | 3504 KB |
09-hidden.txt | AC | 1 ms | 3504 KB |
10-hidden.txt | AC | 1 ms | 3404 KB |
11-hidden.txt | AC | 1 ms | 3476 KB |