Submission #6100178


Source Code Expand

Copy
from datetime import *

N = int(input())

dates = []
x = date(2012,1,1)
while x != date(2013,1,1):
  dates.append(x)
  x += timedelta(days = 1)

se = set()
for _ in range(N):
  m,d = map(int,input().split('/'))
  se.add(date(2012,m,d))

is_holiday = [0] * (len(dates) + 1)
for i,x in enumerate(dates):
  if x.weekday() in [5,6]:
    is_holiday[i] += 1
  if x in se:
    is_holiday[i] += 1
  # 振替休日
  if is_holiday[i] > 1:
    is_holiday[i+1] = is_holiday[i] - 1
    is_holiday[i] = 1

# 連続値の検出
answer = 0
connect = 0
for x in is_holiday[:-1]:
  if x == 0:
    connect = 0
    continue
  connect += 1
  answer = max(answer, connect)

print(answer)

Submission Info

Submission Time
Task B - 超大型連休
User maspy
Language Python (3.4.3)
Score 100
Code Size 702 Byte
Status AC
Exec Time 23 ms
Memory 3388 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 44
Set Name Test Cases
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 01_rand_00.txt, 01_rand_01.txt, 01_rand_02.txt, 01_rand_03.txt, 01_rand_04.txt, 01_rand_05.txt, 01_rand_06.txt, 01_rand_07.txt, 01_rand_08.txt, 01_rand_09.txt, 01_rand_10.txt, 01_rand_11.txt, 01_rand_12.txt, 01_rand_13.txt, 01_rand_14.txt, 01_rand_15.txt, 01_rand_16.txt, 01_rand_17.txt, 01_rand_18.txt, 01_rand_19.txt, 01_rand_20.txt, 01_rand_21.txt, 01_rand_22.txt, 01_rand_23.txt, 01_rand_24.txt, 01_rand_25.txt, 01_rand_26.txt, 01_rand_27.txt, 01_rand_28.txt, 01_rand_29.txt, 01_rand_30.txt, 01_rand_31.txt, 01_rand_32.txt, 01_rand_33.txt, 01_rand_34.txt, 01_rand_35.txt, 01_rand_36.txt, 01_rand_37.txt, 01_rand_38.txt, 01_rand_39.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 22 ms 3388 KB
00_sample_02.txt AC 22 ms 3312 KB
00_sample_03.txt AC 21 ms 3312 KB
00_sample_04.txt AC 22 ms 3312 KB
01_rand_00.txt AC 22 ms 3312 KB
01_rand_01.txt AC 22 ms 3312 KB
01_rand_02.txt AC 22 ms 3312 KB
01_rand_03.txt AC 22 ms 3312 KB
01_rand_04.txt AC 22 ms 3312 KB
01_rand_05.txt AC 22 ms 3312 KB
01_rand_06.txt AC 22 ms 3312 KB
01_rand_07.txt AC 22 ms 3312 KB
01_rand_08.txt AC 22 ms 3312 KB
01_rand_09.txt AC 22 ms 3312 KB
01_rand_10.txt AC 22 ms 3312 KB
01_rand_11.txt AC 22 ms 3312 KB
01_rand_12.txt AC 22 ms 3312 KB
01_rand_13.txt AC 22 ms 3312 KB
01_rand_14.txt AC 22 ms 3312 KB
01_rand_15.txt AC 22 ms 3312 KB
01_rand_16.txt AC 22 ms 3312 KB
01_rand_17.txt AC 22 ms 3312 KB
01_rand_18.txt AC 22 ms 3312 KB
01_rand_19.txt AC 22 ms 3312 KB
01_rand_20.txt AC 22 ms 3312 KB
01_rand_21.txt AC 23 ms 3312 KB
01_rand_22.txt AC 22 ms 3312 KB
01_rand_23.txt AC 22 ms 3312 KB
01_rand_24.txt AC 22 ms 3312 KB
01_rand_25.txt AC 23 ms 3312 KB
01_rand_26.txt AC 23 ms 3312 KB
01_rand_27.txt AC 22 ms 3312 KB
01_rand_28.txt AC 23 ms 3312 KB
01_rand_29.txt AC 23 ms 3388 KB
01_rand_30.txt AC 23 ms 3312 KB
01_rand_31.txt AC 23 ms 3388 KB
01_rand_32.txt AC 23 ms 3312 KB
01_rand_33.txt AC 23 ms 3312 KB
01_rand_34.txt AC 23 ms 3388 KB
01_rand_35.txt AC 23 ms 3312 KB
01_rand_36.txt AC 23 ms 3312 KB
01_rand_37.txt AC 23 ms 3312 KB
01_rand_38.txt AC 23 ms 3312 KB
01_rand_39.txt AC 23 ms 3312 KB