結果

問題 No.1837 Same but Different
ユーザー ygd.ygd.
提出日時 2022-02-11 23:24:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 2,685 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 77,036 KB
最終ジャッジ日時 2023-09-10 06:17:04
合計ジャッジ時間 5,249 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,332 KB
testcase_01 AC 74 ms
71,524 KB
testcase_02 AC 74 ms
71,352 KB
testcase_03 AC 76 ms
71,320 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 85 ms
76,788 KB
testcase_16 AC 82 ms
76,764 KB
testcase_17 AC 83 ms
76,748 KB
testcase_18 AC 87 ms
76,732 KB
testcase_19 AC 86 ms
76,892 KB
testcase_20 AC 87 ms
76,652 KB
testcase_21 AC 87 ms
76,912 KB
testcase_22 AC 85 ms
76,732 KB
testcase_23 AC 88 ms
76,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#input = sys.stdin.readline #文字列につけてはダメ
input = sys.stdin.buffer.readline #文字列につけてはダメ
#sys.setrecursionlimit(1000000)
#import bisect
#import itertools
#import random
#from heapq import heapify, heappop, heappush
#from collections import defaultdict 
#from collections import deque
#import copy
#import math
#from functools import lru_cache
#@lru_cache(maxsize=None)
#MOD = pow(10,9) + 7
#MOD = 998244353
#dx = [1,0,-1,0]
#dy = [0,1,0,-1]

def main():
    N = int(input())
    if N == 5:
        print("9 12 15 18 21")
        print("0 3 16 19 37")
        exit()
    if N == 8:
        print("9 12 15 18 21 24 27 30")
        print("0 3 16 19 22 25 28 43")
        exit()
    if N == 11:
        A = [9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39]
        B = [0, 3, 16, 19, 22, 25, 28, 31, 34, 37, 49]
        print(*A)
        print(*B)
        exit()
    if N == 14:
        A = [9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48]
        B = [0, 3, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 55]   
        print(*A)
        print(*B)
        exit()
    if N == 17:
        A = [9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57]
        B = [0, 3, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 61]  
        print(*A)
        print(*B)
        exit()
    if N%3 == 0:
        A = [3]; B = [4]
        for i in range(N-1):
            if i%3 == 0:
                A.append(A[-1] + 3)
                B.append(B[-1] + 3)
            if i%3 == 1:
                A.append(A[-1] + 6)
                B.append(B[-1] + 3)
            if i%3 == 2:
                A.append(A[-1] + 3)
                B.append(B[-1] + 6)
    elif N%3 == 1:
        A = [3,6,9,12]; B = [0,7,10,13]
        for i in range(N-4):
            if i%3 == 0:
                A.append(A[-1] + 3)
                B.append(B[-1] + 3)
            if i%3 == 1:
                A.append(A[-1] + 6)
                B.append(B[-1] + 3)
            if i%3 == 2:
                A.append(A[-1] + 3)
                B.append(B[-1] + 6)
    else:
        A = [9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66]  
        B = [0, 3, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67]
        for i in range(N-20):
            if i%3 == 0:
                A.append(A[-1] + 3)
                B.append(B[-1] + 3)
            if i%3 == 1:
                A.append(A[-1] + 6)
                B.append(B[-1] + 3)
            if i%3 == 2:
                A.append(A[-1] + 3)
                B.append(B[-1] + 6)
    #print(sum(A),sum(B)) 
    print(*A)
    print(*B)


if __name__ == '__main__':
    main()
0