Submission #932930


Source Code Expand

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)));
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(typename vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)
typedef long  LL;

int N;
int T , A;
LL x , y;

int main(){
	scanf("%d%lld%lld" , &N , &x , &y);
	repp(i,1,N){
		scanf("%d%d" , &T , &A);
		if(x % T != 0) x += (LL)T - (x % T);
		if(y % A != 0) y += (LL)A - (y % A);
		if(x / T < y / A) x = y / A * T;
		else y = x / T * A;
	}
	printf("%lld\n" , x + y);
	return 0;
}

Submission Info

Submission Time
Task C - AtCoDeer and Election Report
User PIandS
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1087 Byte
Status AC
Exec Time 2 ms
Memory 128 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:30:35: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 3 has type ‘LL* {aka long int*}’ [-Wformat=]
  scanf("%d%lld%lld" , &N , &x , &y);
                                   ^
./Main.cpp:30:35: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 4 has type ‘LL* {aka long int*}’ [-Wformat=]
./Main.cpp:38:25: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘LL {aka long int}’ [-Wformat=]
  printf("%lld\n" , x + y);
                         ^
./Main.cpp:30:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%lld%lld" , &N , &x , &y);
                                    ^
./Main.cpp:32:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d" , &T , &A);
                          ^

Judge Result

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