結果

問題 No.1024 Children in a Row
ユーザー chocoruskchocorusk
提出日時 2020-03-05 18:20:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 584 bytes
コンパイル時間 694 ms
コンパイル使用メモリ 76,284 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 07:35:47
合計ジャッジ時間 10,072 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 220 ms
4,348 KB
testcase_04 AC 168 ms
4,352 KB
testcase_05 AC 172 ms
4,348 KB
testcase_06 AC 240 ms
4,348 KB
testcase_07 AC 177 ms
4,352 KB
testcase_08 AC 183 ms
4,352 KB
testcase_09 AC 239 ms
4,352 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <vector>
#include <algorithm>
#include <random>
using namespace std;
int n, m;
int a[200020], b[200020], k[200020];
int main()
{
	scanf("%d %d", &n, &m);
	for(int i=0; i<m; i++) scanf("%d %d %d", &a[i], &b[i], &k[i]);
	for(int l=0; l<m; l++){
		vector<int> v(n);
		iota(v.begin(), v.end(), 1);
		for(int i=0; i<m; i++){
			if(l==i) continue;
			vector<int> tmp;
			for(int j=0; j<n; j++){
				if(v[j]==a[i]) continue;
				tmp.push_back(v[j]);
				if(v[j]==b[i]) tmp.push_back(a[i]);
			}
			swap(v, tmp);
		}
		printf("%d\n", v[k[l]-1]);
	}
    return 0;
}
0