結果
問題 | No.1021 Children in Classrooms |
ユーザー |
![]() |
提出日時 | 2023-05-30 15:10:56 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 617 ms / 2,000 ms |
コード長 | 879 bytes |
コンパイル時間 | 3,341 ms |
コンパイル使用メモリ | 107,776 KB |
実行使用メモリ | 52,988 KB |
最終ジャッジ日時 | 2024-12-28 11:56:37 |
合計ジャッジ時間 | 8,272 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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 + " "); } } } }