Submission #929371


Source Code Expand

Copy
#include<bits/stdc++.h>
#define MOD 1000000007
#define int long long
#define EPS (1e-10)
#define INF 0x3f3f3f3f
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int t[10000], a[10000];
int gcd(int a, int b) {
	if (!b)return a;
	return gcd(b, a%b);
}
int lcm(int a, int b) {
	int g = gcd(max(a,b), min(a,b));
	return (a / g)*(b / g)*g;
}
signed main() {
	int n; scanf("%lld", &n);
	int ans = 1;
	int T = 0, A = 0;
	rep(i, n) {
		scanf("%lld%lld", &t[i], &a[i]);
		int k = t[i] + a[i];
		int j;
		for (j = 1; k*j < ans || ((k*j) / (t[i] + a[i]))*t[i] < T || ((k*j) / (t[i] + a[i]))*a[i] < A; j++);
		T = (k*j / (t[i] + a[i]))*t[i];
		A = (k*j / (t[i] + a[i]))*a[i];
		ans = k*j;
	}
	printf("%lld\n", ans);
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:21:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  int n; scanf("%lld", &n);
                          ^
./Main.cpp:25:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld", &t[i], &a[i]);
                                  ^

Judge Result

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