Submission #1691731
Source Code Expand
#include <bits/stdc++.h> using namespace std; using ll = long long; main() { int N; cin >> N; ll tsum, asum; for (int i = 0; i < N; i++) { int T, A; cin >> T >> A; if (i == 0) { tsum = T, asum = A; } else { ll ta[2]{ tsum, asum }, TA[2]{ T, A }; ll mx = *max_element(begin(ta), end(ta)); for (int j = 0; j < 2; j++) { if (mx == ta[j]) { if (j == 0 && ta[j] == ta[j ^ 1]) j++; for (int k = 1; k < TA[j]; k++) { if ((ta[j] + k) % TA[j] == 0) { ta[j] += k; break; } } ta[j ^ 1] = ta[j] / TA[j] * TA[j ^ 1]; break; } } tsum = ta[0], asum = ta[1]; } } cout << tsum + asum << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - AtCoDeer and Election Report |
User | hrbt |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 791 Byte |
Status | WA |
Exec Time | 7 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 1 ms | 256 KB |
0_001.txt | AC | 1 ms | 256 KB |
0_002.txt | AC | 1 ms | 256 KB |
1_003.txt | AC | 1 ms | 256 KB |
1_004.txt | AC | 1 ms | 256 KB |
1_005.txt | WA | 1 ms | 256 KB |
1_006.txt | WA | 1 ms | 256 KB |
1_007.txt | WA | 1 ms | 256 KB |
1_008.txt | WA | 1 ms | 256 KB |
1_009.txt | WA | 1 ms | 256 KB |
1_010.txt | WA | 1 ms | 256 KB |
1_011.txt | AC | 1 ms | 256 KB |
1_012.txt | AC | 1 ms | 256 KB |
1_013.txt | AC | 2 ms | 256 KB |
1_014.txt | AC | 7 ms | 256 KB |