結果

問題 No.1021 Children in Classrooms
ユーザー suzusuzu
提出日時 2023-05-30 15:10:56
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 625 ms / 2,000 ms
コード長 879 bytes
コンパイル時間 5,072 ms
コンパイル使用メモリ 100,512 KB
実行使用メモリ 50,272 KB
最終ジャッジ日時 2023-08-28 00:38:56
合計ジャッジ時間 11,469 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
17,144 KB
testcase_01 AC 64 ms
17,156 KB
testcase_02 AC 64 ms
17,044 KB
testcase_03 AC 79 ms
17,660 KB
testcase_04 AC 78 ms
17,816 KB
testcase_05 AC 76 ms
17,672 KB
testcase_06 AC 76 ms
17,556 KB
testcase_07 AC 78 ms
17,840 KB
testcase_08 AC 78 ms
17,912 KB
testcase_09 AC 625 ms
45,548 KB
testcase_10 AC 585 ms
45,264 KB
testcase_11 AC 586 ms
45,580 KB
testcase_12 AC 596 ms
45,524 KB
testcase_13 AC 585 ms
45,712 KB
testcase_14 AC 584 ms
45,680 KB
testcase_15 AC 471 ms
46,936 KB
testcase_16 AC 479 ms
47,052 KB
testcase_17 AC 488 ms
45,888 KB
testcase_18 AC 598 ms
50,272 KB
testcase_19 AC 79 ms
21,512 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.Linq;
using System.Collections.Generic;

namespace yukicoder
{
	class pg
	{
		
		static void Main(string[] args)
		{
			var line = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToList();
			int N = line[0];
			int M = line[1];
			var nums = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToList();
			string S = Console.ReadLine();
			
			var linkedList = new LinkedList<int>(nums);
			
			
			
			for(int i = 0;i < M;i++)
			{
				if(S[i] == 'R')
				{
					linkedList.AddFirst(0);
					linkedList.Last.Previous.Value += linkedList.Last.Value;
					linkedList.RemoveLast();
				}else
				{
					linkedList.AddLast(0);
					linkedList.First.Next.Value += linkedList.First.Value;
					linkedList.RemoveFirst();
				}
			}
			var ans = linkedList.ToArray();
			foreach(int i in ans)
			{
				Console.Write(i + " ");
			}
			
		}
	}
}	
0