Submission #11692945


Source Code Expand

import sys
from heapq import heappush, heappop, heappushpop, heapify, heapreplace
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

#ここから書き始める
n = int(input())
a = []
total = 0
for i in range(1, n + 1):
    if total >= n:
        break
    total += i
    a.append(i)
for i in a:
    if i != total - n:
        print(i)

Submission Info

Submission Time
Task B - Exactly N points
User tomoyaatcoder
Language Python (3.4.3)
Score 300
Code Size 2101 Byte
Status AC
Exec Time 41 ms
Memory 5556 KB

Judge Result

Set Name sample dataset1 dataset2
Score / Max Score 0 / 0 200 / 200 100 / 100
Status
AC × 3
AC × 13
AC × 24
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 36 ms 5044 KB
01-02.txt AC 36 ms 5044 KB
01-03.txt AC 36 ms 5044 KB
01-04.txt AC 36 ms 5172 KB
01-05.txt AC 36 ms 5044 KB
01-06.txt AC 36 ms 5044 KB
01-07.txt AC 36 ms 5044 KB
01-08.txt AC 36 ms 5172 KB
01-09.txt AC 36 ms 5172 KB
01-10.txt AC 36 ms 5172 KB
02-01.txt AC 41 ms 5556 KB
02-02.txt AC 41 ms 5556 KB
02-03.txt AC 40 ms 5556 KB
02-04.txt AC 40 ms 5556 KB
02-05.txt AC 40 ms 5556 KB
02-06.txt AC 38 ms 5556 KB
02-07.txt AC 38 ms 5428 KB
02-08.txt AC 40 ms 5556 KB
sample-01.txt AC 36 ms 5044 KB
sample-02.txt AC 36 ms 5172 KB
sample-03.txt AC 36 ms 5172 KB