提出 #76117734


ソースコード 拡げる

using System.Diagnostics;
class Program
{
    static string ReadLine() => Console.ReadLine().Trim();
    static int ReadInt() => int.Parse(ReadLine());
    static long ReadLong() => long.Parse(ReadLine());
    static int[] ReadIntArray() { string str = ReadLine(); return str != "" ? str.Split().Select(_ => int.Parse(_)).ToArray() : new int[0]; }
    static long[] ReadLongArray() { string str = ReadLine(); return str != "" ? str.Split().Select(_ => long.Parse(_)).ToArray() : new long[0]; }
    static (int, int) ReadInt2() { int[] vs = ReadIntArray(); return (vs[0], vs[1]); }
    static (int, int, int) ReadInt3() { int[] vs = ReadIntArray(); return (vs[0], vs[1], vs[2]); }
    static (int, int, int, int) ReadInt4() { int[] vs = ReadIntArray(); return (vs[0], vs[1], vs[2], vs[3]); }
    static (int, int, int, int, int) ReadInt5() { int[] vs = ReadIntArray(); return (vs[0], vs[1], vs[2], vs[3], vs[4]); }
    static (long, long) ReadLong2() { long[] vs = ReadLongArray(); return (vs[0], vs[1]); }

    static void Main()
    {
        SourceExpander.Expander.Expand();

        (int N, int Q) = ReadInt2();

        int[] A = new int[N];
        int[] counts = new int[Q + 1];
        int start = 0;

        List<int> ans = new List<int>();
        for (int i = 0; i < Q; i++)
        {
            (int t, int x) = ReadInt2();
            if (t == 1)
            {
                x--;
                A[x]++;
                int new_cnt = A[x];
                counts[new_cnt]++;
                if (counts[new_cnt] == N)
                    start++;
            }
            if (t == 2)
            {
                try
                {
                    ans.Add(counts[x + start]);
                }
                catch
                {
                    ans.Add(0);
                }
            }
        }
        foreach (var v in ans)
        {
            Console.WriteLine(v);
        }
    }
}
#region Expanded by https://github.com/kzrnm/SourceExpander
namespace SourceExpander{public class Expander{[Conditional("EXP")]public static void Expand(string inputFilePath=null,string outputFilePath=null,bool ignoreAnyError=true){}public static string ExpandString(string inputFilePath=null,bool ignoreAnyError=true){return "";}}}
#endregion Expanded by https://github.com/kzrnm/SourceExpander

提出情報

提出日時
問題 C - Drop Blocks
ユーザ hatodemowakaru
言語 C# 13.0 (.NET Native AOT 9.0.8)
得点 300
コード長 2380 Byte
結果 AC
実行時間 299 ms
メモリ 10176 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 1
AC × 50
セット名 テストケース
Sample example_00.txt
All example_00.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, hand_13.txt, hand_14.txt, hand_15.txt, hand_16.txt, hand_17.txt, hand_18.txt, hand_19.txt, hand_20.txt, hand_21.txt, hand_22.txt, hand_23.txt, hand_24.txt, hand_25.txt, hand_26.txt, hand_27.txt, hand_28.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 1 ms 3552 KiB
hand_00.txt AC 42 ms 7252 KiB
hand_01.txt AC 42 ms 7264 KiB
hand_02.txt AC 285 ms 9904 KiB
hand_03.txt AC 289 ms 9856 KiB
hand_04.txt AC 171 ms 8084 KiB
hand_05.txt AC 165 ms 7680 KiB
hand_06.txt AC 162 ms 7724 KiB
hand_07.txt AC 30 ms 7260 KiB
hand_08.txt AC 293 ms 9024 KiB
hand_09.txt AC 162 ms 8192 KiB
hand_10.txt AC 162 ms 7876 KiB
hand_11.txt AC 31 ms 7152 KiB
hand_12.txt AC 32 ms 7180 KiB
hand_13.txt AC 296 ms 9864 KiB
hand_14.txt AC 166 ms 8416 KiB
hand_15.txt AC 165 ms 7932 KiB
hand_16.txt AC 1 ms 3412 KiB
hand_17.txt AC 299 ms 9288 KiB
hand_18.txt AC 30 ms 7172 KiB
hand_19.txt AC 31 ms 7208 KiB
hand_20.txt AC 31 ms 7264 KiB
hand_21.txt AC 171 ms 8668 KiB
hand_22.txt AC 41 ms 7164 KiB
hand_23.txt AC 291 ms 9732 KiB
hand_24.txt AC 267 ms 10176 KiB
hand_25.txt AC 1 ms 3588 KiB
hand_26.txt AC 1 ms 3876 KiB
hand_27.txt AC 20 ms 7132 KiB
hand_28.txt AC 117 ms 7240 KiB
random_00.txt AC 148 ms 8240 KiB
random_01.txt AC 196 ms 7852 KiB
random_02.txt AC 178 ms 7648 KiB
random_03.txt AC 219 ms 8560 KiB
random_04.txt AC 228 ms 8264 KiB
random_05.txt AC 214 ms 8156 KiB
random_06.txt AC 90 ms 6872 KiB
random_07.txt AC 220 ms 7832 KiB
random_08.txt AC 129 ms 6948 KiB
random_09.txt AC 141 ms 7148 KiB
random_10.txt AC 218 ms 8028 KiB
random_11.txt AC 99 ms 6832 KiB
random_12.txt AC 237 ms 8024 KiB
random_13.txt AC 184 ms 7652 KiB
random_14.txt AC 141 ms 6932 KiB
random_15.txt AC 94 ms 7644 KiB
random_16.txt AC 242 ms 7800 KiB
random_17.txt AC 119 ms 7544 KiB
random_18.txt AC 145 ms 7040 KiB
random_19.txt AC 151 ms 7636 KiB