結果

問題 No.3137 Non-Intersect Chord Triangle Game
ユーザー nikoro256
提出日時 2025-05-02 23:09:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 247 ms / 2,000 ms
コード長 563 bytes
コンパイル時間 460 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 108,144 KB
最終ジャッジ日時 2025-05-02 23:09:11
合計ジャッジ時間 10,280 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 65
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
N,M=map(int,input().split())
In=[0]*(N+1)
OUT=[0]*(N+1)
for _ in range(M):
    P,Q=map(int,input().split())
    P,Q=min(P,Q),max(P,Q)
    In[P]=1
    OUT[Q]=1

def ok(n):
    return n%4==2

if M==0:
    if ok(N):
        print('Akane')
    else:
        print('Aoi')
    exit()

dq = []
dq.append(N+1)
ans = [0]*(N+2)
for i in range(1,N+1):
    if In[i] == 1:
        dq.append(i)
    elif OUT[i] == 1:
        dq.pop()
    else:
        ans[dq[-1]] += 1
for a in ans:
    if ok(a):
        print('Akane')
        exit()
print('Aoi')
0