結果

問題 No.429 CupShuffle
ユーザー kuuso1kuuso1
提出日時 2017-07-01 15:14:17
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 1,509 bytes
コンパイル時間 1,179 ms
コンパイル使用メモリ 107,648 KB
実行使用メモリ 43,764 KB
最終ジャッジ日時 2024-04-15 10:06:36
合計ジャッジ時間 3,010 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
19,072 KB
testcase_01 AC 29 ms
18,944 KB
testcase_02 AC 30 ms
19,072 KB
testcase_03 AC 29 ms
18,944 KB
testcase_04 AC 30 ms
18,944 KB
testcase_05 AC 29 ms
18,944 KB
testcase_06 AC 31 ms
19,200 KB
testcase_07 AC 32 ms
19,200 KB
testcase_08 AC 32 ms
18,944 KB
testcase_09 AC 29 ms
19,200 KB
testcase_10 AC 43 ms
21,760 KB
testcase_11 AC 180 ms
43,764 KB
testcase_12 AC 175 ms
43,516 KB
testcase_13 AC 180 ms
43,520 KB
testcase_14 AC 177 ms
43,636 KB
testcase_15 AC 28 ms
18,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int[] A = Enumerable.Range(1,N).ToArray();
		for(int i=0;i<X;i++){
			int l = int.Parse(Q[i][0]);
			int r = int.Parse(Q[i][1]);
			var t = A[l-1]; A[l-1] = A[r-1]; A[r-1] = t;
		}
		for(int i=K-1;i>X;i--){
			int l = int.Parse(Q[i][0]);
			int r = int.Parse(Q[i][1]);
			var t = C[l-1]; C[l-1] = C[r-1]; C[r-1] = t;
		}
		
		List<int> L = new List<int>();
		for(int i=0;i<N;i++){
			if(A[i] != C[i]) L.Add(i+1);
		}
		Console.WriteLine(String.Join(" ",L));
		
		
		
		
	}
	int N,K,X;
	String[][] Q;
	int[] C;
	public Sol(){
		var d = ria();
		N = d[0]; K = d[1]; X = d[2] - 1;
		Q = new String[K][];
		for(int i=0;i<K;i++) Q[i] = rsa();
		C = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
0