結果

問題 No.101 ぐるぐる!あみだくじ!
ユーザー koyoprokoyopro
提出日時 2015-10-01 23:44:00
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 581 bytes
コンパイル時間 1,287 ms
コンパイル使用メモリ 146,196 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-09-27 01:21:19
合計ジャッジ時間 19,333 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,756 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 564 ms
4,376 KB
testcase_12 AC 980 ms
4,380 KB
testcase_13 AC 1,264 ms
4,376 KB
testcase_14 AC 896 ms
4,380 KB
testcase_15 AC 89 ms
4,380 KB
testcase_16 AC 122 ms
4,380 KB
testcase_17 AC 123 ms
4,376 KB
testcase_18 AC 107 ms
4,380 KB
testcase_19 AC 163 ms
4,384 KB
testcase_20 AC 7 ms
4,380 KB
testcase_21 AC 7 ms
4,380 KB
testcase_22 AC 209 ms
4,380 KB
testcase_23 AC 190 ms
4,376 KB
testcase_24 AC 1,622 ms
4,376 KB
testcase_25 AC 2,144 ms
4,380 KB
testcase_26 AC 1,698 ms
4,380 KB
testcase_27 TLE -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

#define REP(i, n) for(int i=0; i<(n); i++)

int N,K;
bool isok(vector<int> a) {
    REP(i,a.size()) {
        if (a[i] != i) return false;
    }
    return true;
}
signed main()
{
    cin >> N>>K;
    vector<int> amida(N);
    REP(i,N) amida[i] = i;
    vector<int> x(K);
    int y;
    REP(i,K) {
        cin >> x[i] >> y;
    }
    int cnt = 0;
    while(true) {
        cnt++;
        REP(i,K) {
            swap(amida[x[i]-1], amida[x[i]]);
        }
        if (isok(amida)) break;
    }
    cout << cnt << endl;
    return 0;
}
0