Submission #929468
Source Code Expand
#include "bits/stdc++.h" #define _CRT_SECURE_NO_WARNINGS #define rep(i,n) for(int i = 0;i < n;i++) #define REP(i,n,k) for(int i = n;i < k;i++) #define P(p) cout << (p) << endl; #define sP(p) cout << setprecision(15) << fixed << p << endl; #define Pi pair<int,int> #define IINF 1e9 #define LINF 1e18 #define vi vector<int> using namespace std; typedef long long ll; typedef unsigned long long ull; int dx[] = { 1, 0,-1,0 }; int dy[] = { 0, 1,0,-1 }; void solve() { int n; cin >> n; ull A, B; rep(i, n) { ull t, a; cin >> t >> a; if (i == 0) { A = t; B = a; } else { if (A > t || B > a) { double x, y; x = ceil((double)A / (double)t); y = ceil((double)B / (double)a); A = t * max(x, y); B = a * max(x, y); } else if(A <= t && B <= a){ A = t; B = a; } } } P(A + B); } int main() { solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - AtCoDeer and Election Report |
User | pantacia1128 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 913 Byte |
Status | WA |
Exec Time | 3 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 | 3 ms | 256 KB |
0_001.txt | AC | 3 ms | 256 KB |
0_002.txt | AC | 3 ms | 256 KB |
1_003.txt | AC | 3 ms | 256 KB |
1_004.txt | AC | 3 ms | 256 KB |
1_005.txt | WA | 3 ms | 256 KB |
1_006.txt | AC | 3 ms | 256 KB |
1_007.txt | AC | 3 ms | 256 KB |
1_008.txt | AC | 3 ms | 256 KB |
1_009.txt | WA | 3 ms | 256 KB |
1_010.txt | WA | 3 ms | 256 KB |
1_011.txt | AC | 3 ms | 256 KB |
1_012.txt | WA | 3 ms | 256 KB |
1_013.txt | WA | 3 ms | 256 KB |
1_014.txt | AC | 3 ms | 256 KB |