Submission #11342024


Source Code Expand

N=int(input())
ans=[]
count=[]
n=0
for i in range(1,N+1):
    n+=i
    count.append(n)
num=0
for i in range(N):
    if count[i]>=N:
        num=i+1
        break
tmp=N
chk=[0 for _ in range(N+1)]
c=0
while(1):
    if tmp==0:
        break
    if tmp>=num:
        tmp=tmp-num
        ans.append(num)
        chk[num]=1
        num=num-1
        c=num
    else:
        if chk[tmp]==0:
            ans.append(tmp)
            tmp=0
        else:
            for i in range(1,tmp):
                if chk[tmp-i]==0:
                    tmp=tmp-(tmp-i)
                    break
ans.sort()
for i in range(len(ans)):
    print(ans[i])

Submission Info

Submission Time
Task B - Exactly N points
User yutocalling
Language PyPy3 (2.4.0)
Score 200
Code Size 665 Byte
Status MLE
Exec Time 932 ms
Memory 327392 KB

Judge Result

Set Name sample dataset1 dataset2
Score / Max Score 0 / 0 200 / 200 0 / 100
Status
AC × 3
AC × 13
AC × 18
MLE × 6
Set Name Test Cases
sample sample-01.txt, sample-02.txt, sample-03.txt
dataset1 sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt
dataset2 sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-01.txt AC 165 ms 38256 KB
01-02.txt AC 160 ms 38256 KB
01-03.txt AC 160 ms 38256 KB
01-04.txt AC 161 ms 38256 KB
01-05.txt AC 160 ms 38256 KB
01-06.txt AC 161 ms 38256 KB
01-07.txt AC 163 ms 38256 KB
01-08.txt AC 174 ms 38384 KB
01-09.txt AC 162 ms 38256 KB
01-10.txt AC 161 ms 38256 KB
02-01.txt MLE 932 ms 327392 KB
02-02.txt MLE 925 ms 327008 KB
02-03.txt MLE 922 ms 327008 KB
02-04.txt MLE 923 ms 327008 KB
02-05.txt MLE 919 ms 327008 KB
02-06.txt AC 407 ms 130504 KB
02-07.txt AC 297 ms 116420 KB
02-08.txt MLE 915 ms 327136 KB
sample-01.txt AC 160 ms 38256 KB
sample-02.txt AC 160 ms 38256 KB
sample-03.txt AC 161 ms 38256 KB