結果
| 問題 | No.1021 Children in Classrooms |
| コンテスト | |
| ユーザー |
suzu
|
| 提出日時 | 2023-05-30 15:09:26 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 873 bytes |
| コンパイル時間 | 4,588 ms |
| コンパイル使用メモリ | 107,264 KB |
| 実行使用メモリ | 52,872 KB |
| 最終ジャッジ日時 | 2024-12-28 11:56:11 |
| 合計ジャッジ時間 | 8,303 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 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);
}
}
}
}
suzu