Submission #1178610
Source Code Expand
import java.util.*; // ABC 46-C // http://abc047.contest.atcoder.jp/tasks/arc063_a public class Main { static int MOD = 1000000007; public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] t = new int[n]; int[] a = new int[n]; for (int i = 0; i < n; i++) { t[i] = in.nextInt(); a[i] = in.nextInt(); } long tt = t[0]; long aa = a[0]; long base = 1; for (int i = 1; i < n; i++) { while (1 < base && tt <= (base - 1) * t[i] && aa <= (base - 1) * a[i]) { base--; } while (base * t[i] < tt || base * a[i] < aa) { base++; } tt = base * t[i]; aa = base * a[i]; } System.out.println(base * t[n - 1] + base * a[n - 1]); } }
Submission Info
Submission Time | |
---|---|
Task | C - AtCoDeer and Election Report |
User | kohei94 |
Language | Java7 (OpenJDK 1.7.0) |
Score | 0 |
Code Size | 780 Byte |
Status | TLE |
Exec Time | 2108 ms |
Memory | 23708 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
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 | 93 ms | 20436 KB |
0_001.txt | AC | 94 ms | 20436 KB |
0_002.txt | AC | 93 ms | 18772 KB |
1_003.txt | AC | 93 ms | 20820 KB |
1_004.txt | AC | 172 ms | 22228 KB |
1_005.txt | TLE | 2108 ms | 21972 KB |
1_006.txt | TLE | 2108 ms | 20308 KB |
1_007.txt | TLE | 2108 ms | 20052 KB |
1_008.txt | TLE | 2108 ms | 18388 KB |
1_009.txt | TLE | 2108 ms | 20180 KB |
1_010.txt | TLE | 2108 ms | 20052 KB |
1_011.txt | TLE | 2108 ms | 20308 KB |
1_012.txt | TLE | 2108 ms | 22100 KB |
1_013.txt | TLE | 2108 ms | 21076 KB |
1_014.txt | AC | 185 ms | 23708 KB |