Submission #928368


Source Code Expand

Copy
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>

#define ll long long

using namespace std;
long long n;


int main(){
    cin>>n;
    ll a=0,  b=0; cin>>a>>b;
    for(int i=1; i<n; i++){
	ll t1, a1; cin>>t1>>a1;
	ll mult = max((a-1)/t1+1, (b-1)/a1+1);
	a = t1*mult; b = a1*mult;
    }
    cout<<a+b;
}

Submission Info

Submission Time
Task C - AtCoDeer and Election Report
User bas
Language C++14 (GCC 5.4.1)
Score 300
Code Size 365 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 2 ms 256 KB
0_001.txt 3 ms 256 KB
0_002.txt 3 ms 256 KB
1_003.txt 2 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