結果

問題 No.1409 Simple Math in yukicoder
コンテスト
ユーザー 👑 SPD_9X2
提出日時 2021-02-26 22:38:49
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 751 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 176 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 90,624 KB
最終ジャッジ日時 2026-04-19 00:44:44
合計ジャッジ時間 34,431 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24 TLE * 3 -- * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

"""

v,2v,3v…みたいな?

mod xv+1 で考えればよい
後、順番は最後に並べ直せばよい

総和がxv+1の倍数

"""

import sys
from sys import stdin

def solve(lis,v,x):
    mod = v*x+1

    for i in range(1,x):
        now = 0
        for j in lis:
            now += pow(j,i,mod)
        if now % mod != 0:
            return False

    now = 0
    for j in lis:
        now += pow(j,x,mod)
    if now % mod != x:
        return False
    return True

TT = int(stdin.readline())

for loop in range(TT):

    v,x = map(int,stdin.readline().split())
    mod = v*x+1

    for j in range(1,x*v+1):
        a = [pow(j,i,mod) for i in range(x)]
        if solve(a,v,x):
            a.sort()
            print (*a)
            break
0