結果

問題 No.1149 色塗りゲーム
ユーザー lllllll88938494lllllll88938494
提出日時 2023-05-09 17:33:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 2,395 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,576 KB
実行使用メモリ 77,472 KB
平均クエリ数 5.30
最終ジャッジ日時 2024-05-04 15:15:00
合計ジャッジ時間 7,208 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
69,196 KB
testcase_01 AC 91 ms
69,220 KB
testcase_02 AC 89 ms
69,284 KB
testcase_03 AC 89 ms
69,644 KB
testcase_04 AC 88 ms
69,124 KB
testcase_05 AC 84 ms
70,324 KB
testcase_06 AC 87 ms
70,028 KB
testcase_07 AC 88 ms
69,880 KB
testcase_08 AC 83 ms
70,424 KB
testcase_09 AC 86 ms
70,176 KB
testcase_10 WA -
testcase_11 AC 89 ms
71,176 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 85 ms
69,972 KB
testcase_15 AC 85 ms
69,504 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
g=[0]*(n+1)
for i in range(1,n+1):
    g[i] = i%3
    
f = [0]*(n)

while True:
    gs = 0 
    x = []
    t = 0
    for i in range(n):
        if f[i] == 0:
            t += 1
        elif f[i] == 1:
            if t > 0:
                x.append(t)
                gs^=t
            x.append(0)
            t = 0
        
        if i == n-1 and t > 0:
            x.append(t)
            gs^=t

            
    cnt=0
    for i in x:
        if i == 0:
            cnt+=1
            continue
        ff = 0
        for k in range(1,i+1):
            ts=gs
            l,r = k-1,i-k
            ts^=i
            ts^=l
            ts^=r
            cnt += 1
            if ts == 0:
                ff = 1
                break
        if ff:
            break
            
        
    if ff == 1:
        print(1,cnt,flush=True)
        f[cnt-1] = 1
        v=int(input())
        if v == 0 or v == 1:
            exit()
        xx,yy=map(int,input().split())
        if xx == 0:
            exit()
        if xx == 1:
            f[yy-1] = 1
        else:
            f[yy-1] = 1
            f[yy] = 1
 
        continue
        
    cnt=0
    for i in x:
        if i <= 1:
            cnt+=1
            continue
        ff = 0
        for k in range(1,i+1):
            if k == i:
                cnt+=1
                continue
            ts=gs
            l,r = k-1,i-(k+1)
            ts^=i
            ts^=l
            ts^=r
            cnt += 1
            if ts == 0:
                ff = 1
                break
        if ff:
            break
        
    
        
    if ff == 1:
        print(2,cnt,flush=True)
        f[cnt-1] = 1
        f[cnt] = 1
        v=int(input())
        if v == 0 or v == 1:
            exit()
        xx,yy=map(int,input().split())

        if xx == 1:
            f[yy-1] = 1
        else:
            f[yy-1] = 1
            f[yy] = 1

        continue
        
    cnt=0
    for i in x:
        if i == 0:
            cnt+=i
            continue
        if i>0:
            f[cnt-1] = 1
            print(1,cnt,flush=True)
         
            v=int(input())
            if v == 0 or v == 1:
                exit()
            xx,yy=map(int,input().split())
            if xx == 1:
                f[yy-1] = 1
            else:
                f[yy-1] = 1
                f[yy] = 1
            break
  
            
        
0