結果

問題 No.151 セグメントフィッシング
ユーザー 14番14番
提出日時 2016-04-23 01:08:49
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 2,558 bytes
コンパイル時間 816 ms
コンパイル使用メモリ 112,704 KB
実行使用メモリ 56,180 KB
最終ジャッジ日時 2024-04-15 04:16:49
合計ジャッジ時間 10,870 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
24,880 KB
testcase_01 AC 29 ms
27,096 KB
testcase_02 AC 31 ms
27,140 KB
testcase_03 AC 31 ms
27,100 KB
testcase_04 AC 30 ms
24,960 KB
testcase_05 AC 29 ms
25,308 KB
testcase_06 AC 29 ms
25,068 KB
testcase_07 AC 30 ms
25,312 KB
testcase_08 AC 793 ms
44,156 KB
testcase_09 AC 775 ms
44,008 KB
testcase_10 AC 798 ms
42,092 KB
testcase_11 AC 807 ms
46,044 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.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();
    }
}
0