Submission #29021066


Source Code Expand

def main(S):
  x = [0, 0]
  for s in S:
    x.append(s - x[-1] - x[-2])
  c1 = -min(x[::3])
  c2 = -min(x[1::3])
  c3 = min(x[2::3])
  if c1 + c2 > c3:
    return print("No")
  a, b = c1, c2
  add = [a, b, -a-b]
  A = [xi + add[i % 3] for i, xi in enumerate(x)]
  print("Yes")
  print(*A)

N, *S = map(int, open(0).read().split())
main(S)

Submission Info

Submission Time
Task B - Sum of Three Terms
User maspy
Language Python (3.8.2)
Score 500
Code Size 354 Byte
Status AC
Exec Time 247 ms
Memory 49152 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 43
Set Name Test Cases
Sample 01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt
All 01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt, 02_small_Yes_01.txt, 02_small_Yes_02.txt, 02_small_Yes_03.txt, 02_small_Yes_04.txt, 02_small_Yes_05.txt, 03_small_No_01.txt, 03_small_No_02.txt, 03_small_No_03.txt, 03_small_No_04.txt, 03_small_No_05.txt, 04_rand_01.txt, 04_rand_02.txt, 04_rand_03.txt, 04_rand_04.txt, 04_rand_05.txt, 05_rand_yes_01.txt, 05_rand_yes_02.txt, 05_rand_yes_03.txt, 05_rand_yes_04.txt, 05_rand_yes_05.txt, 06_border_01.txt, 06_border_02.txt, 06_border_03.txt, 06_border_04.txt, 06_border_05.txt, 06_border_06.txt, 06_border_07.txt, 06_border_08.txt, 06_border_09.txt, 06_border_10.txt, 06_border_11.txt, 06_border_12.txt, 07_handmade_01.txt, 07_handmade_02.txt, 07_handmade_03.txt, 07_handmade_04.txt, 07_handmade_05.txt, 07_handmade_06.txt, 07_handmade_07.txt, 07_handmade_08.txt
Case Name Status Exec Time Memory
01_sample_01.txt AC 23 ms 8912 KiB
01_sample_02.txt AC 18 ms 9016 KiB
01_sample_03.txt AC 17 ms 9068 KiB
02_small_Yes_01.txt AC 17 ms 8912 KiB
02_small_Yes_02.txt AC 19 ms 8912 KiB
02_small_Yes_03.txt AC 19 ms 9064 KiB
02_small_Yes_04.txt AC 17 ms 8912 KiB
02_small_Yes_05.txt AC 19 ms 9012 KiB
03_small_No_01.txt AC 17 ms 9064 KiB
03_small_No_02.txt AC 18 ms 9200 KiB
03_small_No_03.txt AC 19 ms 9080 KiB
03_small_No_04.txt AC 19 ms 8904 KiB
03_small_No_05.txt AC 17 ms 8916 KiB
04_rand_01.txt AC 137 ms 44076 KiB
04_rand_02.txt AC 139 ms 44132 KiB
04_rand_03.txt AC 138 ms 44132 KiB
04_rand_04.txt AC 139 ms 44148 KiB
04_rand_05.txt AC 138 ms 44084 KiB
05_rand_yes_01.txt AC 239 ms 48952 KiB
05_rand_yes_02.txt AC 237 ms 48880 KiB
05_rand_yes_03.txt AC 243 ms 48776 KiB
05_rand_yes_04.txt AC 238 ms 48776 KiB
05_rand_yes_05.txt AC 239 ms 49152 KiB
06_border_01.txt AC 245 ms 48776 KiB
06_border_02.txt AC 134 ms 44116 KiB
06_border_03.txt AC 244 ms 48948 KiB
06_border_04.txt AC 134 ms 44140 KiB
06_border_05.txt AC 244 ms 49096 KiB
06_border_06.txt AC 137 ms 43964 KiB
06_border_07.txt AC 247 ms 48904 KiB
06_border_08.txt AC 135 ms 43964 KiB
06_border_09.txt AC 244 ms 48904 KiB
06_border_10.txt AC 134 ms 44208 KiB
06_border_11.txt AC 246 ms 49016 KiB
06_border_12.txt AC 134 ms 44132 KiB
07_handmade_01.txt AC 20 ms 9140 KiB
07_handmade_02.txt AC 176 ms 18356 KiB
07_handmade_03.txt AC 18 ms 9016 KiB
07_handmade_04.txt AC 214 ms 44092 KiB
07_handmade_05.txt AC 19 ms 9064 KiB
07_handmade_06.txt AC 115 ms 27088 KiB
07_handmade_07.txt AC 121 ms 27260 KiB
07_handmade_08.txt AC 115 ms 27404 KiB