Submission #7022265


Source Code Expand

n,y = map(int,input().split())
man,gosen,sen=0,0,0
man_max = y//10000
flag=False

for i in range(man_max+1):
  man = man_max-i
  #print("man :",man)
  temp_y = y - 10000*man
  temp_n = n - man
  gosen_max = temp_y//5000
  for j in range(gosen_max+1):
    gosen = gosen_max-j
    #print("gosen :",gosen)
    temp_temp_y = temp_y - 5000*gosen 
    temp_temp_n = temp_n - gosen
    if temp_temp_y/1000==temp_temp_n:
      sen = temp_temp_n
      flag=True
      break
  if flag:
    break

if flag:
  print(str(man) + " " + str(gosen) + " " + str(sen))
else:
  print("-1 -1 -1")

Submission Info

Submission Time
Task C - Otoshidama
User kentaro0407
Language Python (3.4.3)
Score 300
Code Size 601 Byte
Status AC
Exec Time 1430 ms
Memory 3064 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 24
Set Name Test Cases
Sample a01, a02, a03, a04
All a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24
Case Name Status Exec Time Memory
a01 AC 17 ms 3064 KB
a02 AC 17 ms 3064 KB
a03 AC 21 ms 3064 KB
a04 AC 17 ms 3064 KB
b05 AC 17 ms 3060 KB
b06 AC 17 ms 3064 KB
b07 AC 17 ms 3060 KB
b08 AC 33 ms 3064 KB
b09 AC 17 ms 3064 KB
b10 AC 33 ms 3064 KB
b11 AC 1357 ms 3064 KB
b12 AC 34 ms 3064 KB
b13 AC 33 ms 3064 KB
b14 AC 33 ms 3064 KB
b15 AC 17 ms 3064 KB
b16 AC 17 ms 3064 KB
b17 AC 17 ms 3064 KB
b18 AC 17 ms 3064 KB
b19 AC 17 ms 3064 KB
b20 AC 24 ms 3064 KB
b21 AC 33 ms 3064 KB
b22 AC 32 ms 3064 KB
b23 AC 1430 ms 3064 KB
b24 AC 1267 ms 3064 KB