結果

問題 No.1306 Exactly 2 Digits
ユーザー vwxyzvwxyz
提出日時 2024-01-01 21:32:40
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,476 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 103,400 KB
平均クエリ数 444.40
最終ジャッジ日時 2024-01-01 21:33:24
合計ジャッジ時間 42,189 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,608 KB
testcase_01 AC 61 ms
71,608 KB
testcase_02 AC 60 ms
71,600 KB
testcase_03 AC 64 ms
71,600 KB
testcase_04 AC 64 ms
71,600 KB
testcase_05 AC 61 ms
71,600 KB
testcase_06 AC 61 ms
71,600 KB
testcase_07 AC 60 ms
71,600 KB
testcase_08 AC 61 ms
71,600 KB
testcase_09 AC 61 ms
71,600 KB
testcase_10 AC 62 ms
71,600 KB
testcase_11 AC 61 ms
71,600 KB
testcase_12 AC 61 ms
71,600 KB
testcase_13 AC 62 ms
71,608 KB
testcase_14 AC 62 ms
71,608 KB
testcase_15 AC 62 ms
71,608 KB
testcase_16 AC 87 ms
71,608 KB
testcase_17 AC 62 ms
71,608 KB
testcase_18 AC 63 ms
71,608 KB
testcase_19 AC 66 ms
71,608 KB
testcase_20 AC 62 ms
71,608 KB
testcase_21 AC 62 ms
71,608 KB
testcase_22 AC 62 ms
71,608 KB
testcase_23 AC 63 ms
71,608 KB
testcase_24 AC 64 ms
71,608 KB
testcase_25 AC 63 ms
71,608 KB
testcase_26 AC 64 ms
71,608 KB
testcase_27 AC 62 ms
71,608 KB
testcase_28 AC 62 ms
71,608 KB
testcase_29 AC 64 ms
71,608 KB
testcase_30 AC 62 ms
71,608 KB
testcase_31 AC 63 ms
71,608 KB
testcase_32 AC 64 ms
71,608 KB
testcase_33 AC 64 ms
71,608 KB
testcase_34 AC 64 ms
71,608 KB
testcase_35 AC 64 ms
71,608 KB
testcase_36 AC 65 ms
71,608 KB
testcase_37 AC 66 ms
71,608 KB
testcase_38 AC 64 ms
71,608 KB
testcase_39 AC 64 ms
71,608 KB
testcase_40 AC 65 ms
71,608 KB
testcase_41 AC 66 ms
71,608 KB
testcase_42 AC 65 ms
71,608 KB
testcase_43 AC 65 ms
71,608 KB
testcase_44 AC 79 ms
82,244 KB
testcase_45 AC 73 ms
79,908 KB
testcase_46 AC 83 ms
82,228 KB
testcase_47 AC 90 ms
86,488 KB
testcase_48 AC 84 ms
79,908 KB
testcase_49 AC 103 ms
91,748 KB
testcase_50 AC 98 ms
88,536 KB
testcase_51 AC 135 ms
91,856 KB
testcase_52 AC 140 ms
92,236 KB
testcase_53 AC 107 ms
88,656 KB
testcase_54 AC 180 ms
92,388 KB
testcase_55 AC 163 ms
92,232 KB
testcase_56 AC 225 ms
92,272 KB
testcase_57 AC 203 ms
92,392 KB
testcase_58 AC 161 ms
92,392 KB
testcase_59 AC 328 ms
92,520 KB
testcase_60 AC 136 ms
92,004 KB
testcase_61 AC 227 ms
92,400 KB
testcase_62 AC 284 ms
92,524 KB
testcase_63 AC 391 ms
92,648 KB
testcase_64 AC 179 ms
92,248 KB
testcase_65 AC 351 ms
92,632 KB
testcase_66 AC 225 ms
92,524 KB
testcase_67 AC 241 ms
92,652 KB
testcase_68 AC 650 ms
93,548 KB
testcase_69 AC 400 ms
93,164 KB
testcase_70 AC 1,078 ms
95,852 KB
testcase_71 AC 343 ms
93,548 KB
testcase_72 AC 910 ms
95,596 KB
testcase_73 AC 1,185 ms
96,748 KB
testcase_74 AC 545 ms
94,188 KB
testcase_75 AC 1,295 ms
97,260 KB
testcase_76 AC 1,337 ms
97,644 KB
testcase_77 AC 1,665 ms
99,052 KB
testcase_78 AC 750 ms
94,956 KB
testcase_79 TLE -
testcase_80 AC 1,354 ms
98,796 KB
testcase_81 TLE -
testcase_82 AC 1,253 ms
100,136 KB
testcase_83 AC 778 ms
95,832 KB
testcase_84 AC 784 ms
96,452 KB
testcase_85 AC 1,749 ms
103,400 KB
testcase_86 AC 1,237 ms
98,788 KB
testcase_87 AC 1,534 ms
102,252 KB
testcase_88 AC 963 ms
98,244 KB
testcase_89 TLE -
testcase_90 TLE -
testcase_91 -- -
testcase_92 -- -
testcase_93 -- -
testcase_94 -- -
testcase_95 -- -
testcase_96 -- -
testcase_97 -- -
testcase_98 -- -
testcase_99 -- -
testcase_100 -- -
testcase_101 -- -
testcase_102 -- -
testcase_103 -- -
testcase_104 -- -
testcase_105 -- -
testcase_106 -- -
testcase_107 -- -
testcase_108 -- -
testcase_109 -- -
testcase_110 -- -
testcase_111 -- -
testcase_112 -- -
testcase_113 -- -
testcase_114 -- -
testcase_115 -- -
testcase_116 -- -
testcase_117 -- -
testcase_118 -- -
testcase_119 -- -
testcase_120 -- -
testcase_121 -- -
testcase_122 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N=int(input())
i=0
dct=defaultdict(list)
PQ=[]
for j in range(1,N**2-N):
    print("?",i+1,j+1)
    p,q=map(int,input().split())
    dct[(p,q)].append(j)
    PQ.append((p,q))
PQ.sort()
X,Y=[None]*(N*N-N),[None]*(N*N-N)
for x in range(1,N):
    for y in range(N):
        lst=[]
        for xx in range(1,N):
            for yy in range(N):
                if x==xx and y==yy:
                    continue
                p,q=x-xx,y-yy
                if p>q:
                    p,q=q,p
                lst.append((p,q))
        lst.sort()
        if lst==PQ:
            X[i]=x
            Y[i]=y
            break
    else:
        continue
    break
else:
    assert False
for (p,q),lst in dct.items():
    if len(lst)==1:
        j=lst[0]
        for xx,yy in ((x-p,y-q),(x-q,y-p)):
            if 1<=xx<N and 0<=yy<N:
                X[j]=xx
                Y[j]=yy
for ii in range(N*N-N):
    if X[ii]!=None and X[ii]-Y[ii]!=X[i]-Y[i]:
        i=ii
        break
else:
    assert False
for (p,q),lst in dct.items():
    if len(lst)==2:
        j=lst[0]
        print("?",i+1,j+1)
        pp,qq=map(int,input().split())
        for xx,yy in ((x-p,y-q),(x-q,y-p)):
            if sorted([X[i]-xx,Y[i]-yy])==[pp,qq]:
                X[j]=xx
                Y[j]=yy
                break
        else:
            assert False
        jj=lst[1]
        X[jj]=2*x-p-q-xx
        Y[jj]=2*y-p-q-yy
A=[x*N+y for x,y in zip(X,Y)]
print("!",*A)
0