結果

問題 No.1837 Same but Different
ユーザー chineristAC
提出日時 2022-02-11 21:59:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,138 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 67,072 KB
最終ジャッジ日時 2024-06-27 18:33:24
合計ジャッジ時間 3,529 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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)]
    tmp = N - 2
    A[-2] += 1
    A[-3] += 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)
0