Submission #928595


Source Code Expand

#define yuki(x, y) for(int i = x; i < (y); ++i)
#define yukj(x, y) for(int j = x; j < (y); ++j)
#define yukii(x, y) for(int i = x; i <= (y); ++i)
#define yukji(x, y) for(int j = x; j <= (y); ++j)
#define yuk(x, y, z) for(int x = y; x < (z); ++x)
#define yui(x, y, z) for(int x = y; x >= (z); --x)
#define sclr(x) memset(x, 0, sizeof(x))
#define sclr1(x) memset(x, -1, sizeof(x))
#define scl(x, y) memset(x, y, sizeof(x))
#define ft first
#define sc second
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long lol;
int n, t[1010], a[1010];
lol l, r;
void sread()
{
    scanf("%d", &n);
    yuki(0, n) scanf("%d%d", t+i, a+i);
}
int main(int argc, char **argv)
{
	sread();
	l = r = 1ll;
	yuki(0, n)
	{
	    lol k1 = l%t[i], k2 = r%a[i];
	    if(k1) l += t[i]-k1;
	    if(k2) r += a[i]-k2;
	    k1 = l/t[i], k2 = r/a[i];
	    if(k1 < k2) l += (k2-k1)*t[i];
	    else if(k1 > k2) r += (k1-k2)*a[i];
	}
	printf("%lld\n", l+r);
	return 0;
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘void sread()’:
./Main.cpp:21:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
./Main.cpp:22:39: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     yuki(0, n) scanf("%d%d", t+i, a+i);
                                       ^

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 1 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