結果
| 問題 | No.382 シャイな人たち (2) |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2026-02-14 01:34:55 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,324 bytes |
| 記録 | |
| コンパイル時間 | 250 ms |
| コンパイル使用メモリ | 82,816 KB |
| 実行使用メモリ | 84,684 KB |
| 最終ジャッジ日時 | 2026-02-14 01:37:53 |
| 合計ジャッジ時間 | 176,026 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 2 TLE * 1 |
ソースコード
from random import randint,random
from time import time
time0=time()
S=int(input())
S=(S*12345)%1000003
N=(S%120)+2
S=(S*12345)%1000003
P=S
F=[[0]*N for i in range(N)]
for i in range(1,N+1):
for j in range(i+1,N+1):
S=(S*12345)%1000003
F[i-1][j-1]=S
F[j-1][i-1]=S
#print(F)
#print(P)
for i in range(N):
for j in range(N):
if F[i][j]>=P:
F[i][j]=1
else:
F[i][j]=0
MAX=0
ANS=[]
start_temp=N//2
end_temp=0.1
lasttime=7.8
NOW=[0]*N
nowscore=0
while time()-time0<7.8:
#print(nowscore,NOW)
temp=start_temp+(end_temp - start_temp) * (time()-time0) /lasttime
if nowscore>MAX:
MAX=nowscore
ANS=NOW[:]
while True:
x=randint(0,N-1)
if NOW[x]==1:
continue
else:
break
TO=NOW[:]
TO[x]=1
toscore=nowscore+1
for i in range(N):
if F[x][i]==1 and TO[i]==1:
TO[i]=0
toscore-=1
if toscore>=nowscore:
nowscore=toscore
NOW=TO[:]
else:
prob = pow(2.7,(toscore-nowscore)/temp)
if prob>random():
nowscore=toscore
NOW=TO[:]
else:
pass
print(MAX+1)
LANS=[]
for i in range(N):
if ANS[i]==1:
LANS.append(i+1)
print(*LANS)
titia