結果
| 問題 |
No.151 セグメントフィッシング
|
| コンテスト | |
| ユーザー |
14番
|
| 提出日時 | 2016-04-23 01:08:49 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 2,558 bytes |
| コンパイル時間 | 948 ms |
| コンパイル使用メモリ | 112,800 KB |
| 実行使用メモリ | 51,836 KB |
| 最終ジャッジ日時 | 2024-10-04 15:14:25 |
| 合計ジャッジ時間 | 11,231 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 7 TLE * 1 -- * 11 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
class Program
{
public void Proc()
{
Reader.IsDebug = false;
int[] inpt = Reader.GetInt();
int areaLength = inpt[0];
int queryCount = inpt[1];
long[] leftDic = new long[areaLength];
long[] rightDic = new long[areaLength];
for(int i=0; i<queryCount; i++) {
List<long> subL = new List<long>();
List<long> subR = new List<long>();
subL.AddRange(leftDic);
subL.RemoveAt(0);
subR.Add(leftDic[0]);
subR.AddRange(rightDic);
subL.Add(subR.Last());
subR.RemoveAt(subR.Count - 1);
string[] tmp = Reader.ReadLine().Split(' ');
int num1 = int.Parse(tmp[1]);
int num2 = int.Parse(tmp[2]);
if(tmp[0].Equals("R")) {
subR[num1] += num2;
} else if(tmp[0].Equals("L")) {
subL[num1] += num2;
}
rightDic = subR.ToArray();
leftDic = subL.ToArray();
if(tmp[0].Equals("C")) {
long ans = rightDic.Skip(num1).Take(num2-num1).Sum();
ans += leftDic.Skip(num1).Take(num2-num1).Sum();
Console.WriteLine(ans);
}
}
}
public class Reader
{
public static bool IsDebug = true;
private static String PlainInput = @"
4 3
R 3 3
C 0 4
C 1 2
";
private static System.IO.StringReader Sr = null;
public static string ReadLine()
{
if (IsDebug)
{
if (Sr == null)
{
Sr = new System.IO.StringReader(PlainInput.Trim());
}
return Sr.ReadLine();
}
else
{
return Console.ReadLine();
}
}
public static int[] GetInt(char delimiter = ' ', bool trim = false)
{
string inptStr = ReadLine();
if (trim)
{
inptStr = inptStr.Trim();
}
string[] inpt = inptStr.Split(delimiter);
int[] ret = new int[inpt.Length];
for (int i = 0; i < inpt.Length; i++)
{
ret[i] = int.Parse(inpt[i]);
}
return ret;
}
}
static void Main()
{
Program prg = new Program();
prg.Proc();
}
}
14番