Submission #1439471


Source Code Expand

import strutils
import algorithm
import sequtils
import math
from future import `=>`

let N = stdin.readLine.parseInt

var result = (votes_t: 1, votes_a: 1)

for i in 0..<N:
  let
    ta = stdin.readLine.split(' ').map(parseInt)
    T = ta[0]
    A = ta[1]

  let 
    t2 = result.votes_t / T
    a2 = result.votes_a / A

  var next: int
  if t2 > a2:
    next = result.votes_t div T + (if result.votes_t mod T != 0: 1 else: 0)
  else:
    next = result.votes_a div A + (if result.votes_a mod A != 0: 1 else: 0)
  result = (votes_t: (next * T), votes_a: (next * A))

echo result.votes_t + result.votes_a

Submission Info

Submission Time
Task C - AtCoDeer and Election Report
User nonylene
Language Nim (0.13.0)
Score 300
Code Size 632 Byte
Status AC
Exec Time 1 ms
Memory 508 KB

Compile Error

Hint: system [Processing]
Hint: Main [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: algorithm [Processing]
Hint: sequtils [Processing]
Hint: math [Processing]
Hint: times [Processing]
Hint: future [Processing]
Hint: macros [Processing]
Hint:  [Link]
Hint: operation successful (16308 lines compiled; 2.001 sec total; 16.169MB; Release Build) [SuccessX]

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 256 KB
0_001.txt AC 1 ms 256 KB
0_002.txt AC 1 ms 256 KB
1_003.txt AC 1 ms 256 KB
1_004.txt AC 1 ms 508 KB
1_005.txt AC 1 ms 256 KB
1_006.txt AC 1 ms 380 KB
1_007.txt AC 1 ms 256 KB
1_008.txt AC 1 ms 256 KB
1_009.txt AC 1 ms 256 KB
1_010.txt AC 1 ms 256 KB
1_011.txt AC 1 ms 256 KB
1_012.txt AC 1 ms 256 KB
1_013.txt AC 1 ms 508 KB
1_014.txt AC 1 ms 508 KB