結果

問題 No.101 ぐるぐる!あみだくじ!
ユーザー cielciel
提出日時 2014-12-11 23:35:41
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 480 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 46,900 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-09-02 14:06:25
合計ジャッジ時間 21,913 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,220 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 152 ms
4,380 KB
testcase_12 AC 160 ms
4,376 KB
testcase_13 AC 138 ms
4,380 KB
testcase_14 AC 224 ms
4,380 KB
testcase_15 AC 15 ms
4,380 KB
testcase_16 AC 20 ms
4,380 KB
testcase_17 AC 23 ms
4,376 KB
testcase_18 AC 29 ms
4,376 KB
testcase_19 AC 33 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 49 ms
4,380 KB
testcase_23 AC 27 ms
4,380 KB
testcase_24 AC 450 ms
4,376 KB
testcase_25 AC 308 ms
4,376 KB
testcase_26 AC 226 ms
4,376 KB
testcase_27 AC 3,464 ms
4,376 KB
testcase_28 AC 2,114 ms
4,380 KB
testcase_29 AC 1,943 ms
4,376 KB
testcase_30 AC 1,594 ms
4,376 KB
testcase_31 AC 1,589 ms
4,380 KB
testcase_32 AC 1,547 ms
4,376 KB
testcase_33 TLE -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdio>
using namespace std;
int main(){
	int N,K;
	scanf("%d%d",&N,&K);
	vector<int>shuf(N);
	iota(shuf.begin(),shuf.end(),0);
	vector<int>orig=shuf;
	for(int i=0;i<K;i++){
		int a,b;
		scanf("%d%d",&a,&b),a--,b--;
		swap(shuf[a],shuf[b]);
	}
	vector<int>v=shuf;
	int x=1;
	for(;v!=orig;x++){
		vector<int>nxt(N);
		for(int i=0;i<N;i++)nxt[i]=v[shuf[i]];
		v=nxt;
	}
	printf("%d\n",x);
}
0