Submission #928761


Source Code Expand

#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<pii,int> ppiii ;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
int main(){
	int n;
	cin>>n;
	ll x=0,y=0,a,b,now=0;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		ll t=((x-(ll)1)/a+(ll)1),s=((y-(ll)1)/b+(ll)1);
		int c=0;
		if(x<=a*s&&y<=b*s)x=a*s,y=b*s,c=1;
		if(x<=a*t&&y<=b*t){
			if(c==1)x=min(x,a*t),y=min(y,b*t);
			else x=a*t,y=b*t;
		}
		//cout<<x<<" "<<y<<endl;
	}
	cout<<x+y<<endl;
}

Submission Info

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

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 12
WA × 3
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 2 ms 256 KB
0_001.txt AC 2 ms 256 KB
0_002.txt AC 3 ms 256 KB
1_003.txt AC 3 ms 256 KB
1_004.txt WA 3 ms 256 KB
1_005.txt AC 3 ms 256 KB
1_006.txt WA 3 ms 256 KB
1_007.txt WA 3 ms 256 KB
1_008.txt AC 3 ms 256 KB
1_009.txt AC 3 ms 256 KB
1_010.txt AC 2 ms 256 KB
1_011.txt AC 3 ms 256 KB
1_012.txt AC 3 ms 256 KB
1_013.txt AC 3 ms 256 KB
1_014.txt AC 3 ms 256 KB