結果
| 問題 | No.101 ぐるぐる!あみだくじ! | 
| コンテスト | |
| ユーザー |  HIROPON87069639 | 
| 提出日時 | 2016-02-15 22:09:48 | 
| 言語 | Python2 (2.7.18) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 428 bytes | 
| コンパイル時間 | 94 ms | 
| コンパイル使用メモリ | 7,072 KB | 
| 実行使用メモリ | 13,888 KB | 
| 最終ジャッジ日時 | 2024-09-22 07:11:14 | 
| 合計ジャッジ時間 | 7,116 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | -- * 3 | 
| other | AC * 11 TLE * 1 -- * 25 | 
ソースコード
# -*- coding: utf-8 -*-
N = input()
K = input()
Alist = [i+1 for i in range(0, N)]
Blist = [i+1 for i in range(0, N)]
Klist = [0 for i in range(0, K)]
for i in range(0, K):
    Klist[i] = map(int, raw_input().split())[0] - 1
for i in Klist:
        Alist[i], Alist[i+1] = Alist[i+1], Alist[i]
flag = 0
cnt = 1
while Alist != Blist:
    cnt += 1
    for i in Klist:
        Alist[i], Alist[i+1] = Alist[i+1], Alist[i]
print cnt
            
            
            
        