Submission #1988652
Source Code Expand
// UNNECESSARY // #include <chrono>//std::chrono::/system_clock/steady_clock/high_resolution_clock/duration // #include <cstdio>//printf/scanf/fopen/fclose/fprintf/fscanf/snprintf/putc/puts/getc/gets // #include <fstream>//ifstream/ofstream // DATA STRUCTURES #include <array> #include <bitset> #include <list> #include <queue> #include <map> #include <set> #include <stack> #include <tuple> #include <valarray> #include <vector> // MISCELLANEOUS #include <algorithm>//min/max/sort(rand-access it)/merge #include <cassert> #include <climits>//INT_MAX/INT_MIN/ULLONG_MAX #include <cmath>//fmin/fmax/fabs/sin(h)/cos(h)/tan(h)/exp/log/pow/sqrt/cbrt/ceil/floor/round/trunc #include <cstdlib>//abs/atof/atoi/atol/atoll/strtod/strtof/..., srand/rand, calloc/malloc, exit, qsort #include <iomanip>//setfill/setw/setprecision/fixed/scientific #include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific #include <iterator> #include <limits>//numeric_limits<type>::max/min/lowest/epsilon/infinity/quiet_NaN/signaling_NaN #include <new> #include <string>//stoi/stol/stoul/stoll/stoull/stof/stod/stold/to_string/getline #include <utility>//pair #ifndef REP #define REP(i,n) for (int i = 0; i < n; ++i) #endif #ifndef REPST #define REPST(i,n) for (size_t i = 0; i < n; ++i) #endif #ifndef READ #define READ(x) std::cin >> x #endif typedef unsigned int ui; typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii; typedef std::pair<ll, int> plli; typedef std::pair<ull, int> puli; typedef std::pair<double, int> pdi; typedef std::pair<ll, ll> pllll; typedef std::pair<ull, ull> pulul; typedef std::pair<double, double> pdd; typedef std::tuple<int, int, int> ti3; typedef std::tuple<int, int, int, int> ti4; const bool debug = false; // -------------------------------------------------------------------------------------- using namespace std; int main(void) { int n; cin >> n; int* count = new int[n]; string* names = new string[n]; REP(i,n) { count[i] = 0; names[i] = ""; } REP(voter,n) { string vote; cin >> vote; REP(i,n) { if (names[i] == "") names[i] = vote; if (names[i] == vote) { ++(count[i]); break; } } } cout << names[*max_element(count, count+n)] << endl; delete[] count; delete[] names; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - 投票 |
User | L3Sota |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 2528 Byte |
Status | RE |
Exec Time | 97 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 100 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, case_01.txt, case_02.txt, case_03.txt, case_04.txt, case_05.txt, case_06.txt, case_07.txt, case_08.txt, case_09.txt, case_10.txt, case_11.txt, case_12.txt, case_13.txt, case_14.txt, case_15.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
case_01.txt | WA | 1 ms | 256 KB |
case_02.txt | RE | 97 ms | 256 KB |
case_03.txt | WA | 1 ms | 256 KB |
case_04.txt | RE | 96 ms | 256 KB |
case_05.txt | WA | 1 ms | 256 KB |
case_06.txt | WA | 1 ms | 256 KB |
case_07.txt | WA | 1 ms | 256 KB |
case_08.txt | WA | 1 ms | 256 KB |
case_09.txt | WA | 1 ms | 256 KB |
case_10.txt | RE | 97 ms | 256 KB |
case_11.txt | WA | 1 ms | 256 KB |
case_12.txt | WA | 1 ms | 256 KB |
case_13.txt | WA | 1 ms | 256 KB |
case_14.txt | WA | 1 ms | 256 KB |
case_15.txt | WA | 1 ms | 256 KB |
sample_01.txt | WA | 1 ms | 256 KB |
sample_02.txt | RE | 96 ms | 256 KB |
sample_03.txt | WA | 1 ms | 256 KB |