結果

問題 No.1837 Same but Different
ユーザー chineristACchineristAC
提出日時 2022-02-11 22:15:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 1,680 bytes
コンパイル時間 482 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 79,828 KB
最終ジャッジ日時 2023-09-10 03:32:23
合計ジャッジ時間 5,597 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
74,252 KB
testcase_01 AC 116 ms
74,272 KB
testcase_02 AC 116 ms
74,268 KB
testcase_03 AC 117 ms
74,540 KB
testcase_04 AC 126 ms
79,752 KB
testcase_05 AC 128 ms
79,720 KB
testcase_06 AC 129 ms
79,276 KB
testcase_07 AC 128 ms
79,284 KB
testcase_08 AC 124 ms
79,752 KB
testcase_09 AC 125 ms
79,828 KB
testcase_10 AC 125 ms
79,752 KB
testcase_11 AC 129 ms
79,704 KB
testcase_12 AC 129 ms
79,760 KB
testcase_13 AC 129 ms
79,760 KB
testcase_14 AC 128 ms
79,764 KB
testcase_15 AC 126 ms
79,516 KB
testcase_16 AC 125 ms
79,708 KB
testcase_17 AC 125 ms
79,376 KB
testcase_18 AC 130 ms
79,556 KB
testcase_19 AC 130 ms
79,556 KB
testcase_20 AC 125 ms
79,344 KB
testcase_21 AC 128 ms
79,788 KB
testcase_22 AC 125 ms
79,724 KB
testcase_23 AC 126 ms
79,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import log,gcd

input = lambda :sys.stdin.readline()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N = int(input())

if N%3==0:
    A = [3*i for i in range(N)] + [10001]
    B = [3*i+1 for i in range(N)]
    tmp = N
    for i in range(N)[::-1]:
        while tmp and A[i]+3 < A[i+1]:
            A[i] += 3
            tmp -= 3
    
    assert tmp == 0
    print(*A[:N])
    print(*B)

elif N%3==1:
    A = [3*i for i in range(N)] + [10001]
    B = [3*i+1 for i in range(N)]
    tmp = N - 1
    A[-2] += 1
    for i in range(N)[::-1]:
        while tmp and A[i]+3 < A[i+1]:
            A[i] += 3
            tmp -= 3
    
    assert tmp==0
    print(*A[:N])
    print(*B)

else:
    A = [3*i for i in range(N)] + [10001]
    B = [3*i+1 for i in range(N)]
    if N >= 14:
        tmp = N - 14
        A[-2] += 7
        A[-3] += 7
    else:
        if N==5:
            A = [5,6,7,8,9]
            B = [1,2,3,4,25]
            print(*A)
            print(*B)
            exit()
        
        elif N==8:
            A = [10,11,12,13,14,15,16,17]
            B = [1,2,3,4,5,6,7,87]
            print(*A)
            print(*B)
            exit()
        
        elif N == 11:
            A = [30+i for i in range(11)]
            B = [1,2,3,4,5,6,7,8,9,10,sum(A)-55]
            print(*A)
            print(*B)
            exit()

    for i in range(N)[::-1]:
        while tmp and A[i]+3 < A[i+1]:
            A[i] += 3
            tmp -= 3
    
    #assert tmp==0
    print(*A[:N])
    print(*B)

    

    
0