Submission #928661


Source Code Expand

Copy
#include <iostream>
using namespace std;
typedef unsigned long long ull;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

    int N;
    cin >> N;
    ull T, A;
    ull v1 = 1, v2 = 1;
    for(int i=0; i<N; i++){
        cin >> T >> A;
        ull u1 = v1 / T;
        ull u2 = v2 / A;
        if(v1 % T) u1++;
        if(v2 % A) u2++;
        ull m = max(u1, u2);
        v1 = m * T;
        v2 = m * A;
    }
    cout << v1 + v2 << endl;

	return 0;
}

Submission Info

Submission Time
Task C - AtCoDeer and Election Report
User suzume
Language C++14 (GCC 5.4.1)
Score 300
Code Size 488 Byte
Status
Exec Time 3 ms
Memory 256 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_000.txt, 0_001.txt, 0_002.txt
All 300 / 300 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 3 ms 256 KB
0_001.txt 3 ms 256 KB
0_002.txt 3 ms 256 KB
1_003.txt 3 ms 256 KB
1_004.txt 3 ms 256 KB
1_005.txt 3 ms 256 KB
1_006.txt 3 ms 256 KB
1_007.txt 3 ms 256 KB
1_008.txt 3 ms 256 KB
1_009.txt 3 ms 256 KB
1_010.txt 3 ms 256 KB
1_011.txt 3 ms 256 KB
1_012.txt 3 ms 256 KB
1_013.txt 3 ms 256 KB
1_014.txt 3 ms 256 KB