結果

問題 No.709 優勝可能性
ユーザー bluemeganebluemegane
提出日時 2018-09-27 10:11:54
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 841 ms / 3,500 ms
コード長 1,544 bytes
コンパイル時間 955 ms
コンパイル使用メモリ 112,868 KB
実行使用メモリ 29,312 KB
最終ジャッジ日時 2024-04-20 09:03:23
合計ジャッジ時間 10,272 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
17,664 KB
testcase_01 AC 26 ms
17,792 KB
testcase_02 AC 27 ms
17,792 KB
testcase_03 AC 27 ms
17,792 KB
testcase_04 AC 27 ms
17,920 KB
testcase_05 AC 27 ms
17,920 KB
testcase_06 AC 27 ms
17,920 KB
testcase_07 AC 27 ms
17,792 KB
testcase_08 AC 27 ms
17,664 KB
testcase_09 AC 27 ms
18,048 KB
testcase_10 AC 584 ms
22,012 KB
testcase_11 AC 526 ms
21,872 KB
testcase_12 AC 748 ms
22,044 KB
testcase_13 AC 765 ms
21,884 KB
testcase_14 AC 742 ms
22,000 KB
testcase_15 AC 768 ms
21,756 KB
testcase_16 AC 733 ms
22,912 KB
testcase_17 AC 771 ms
29,312 KB
testcase_18 AC 27 ms
18,048 KB
testcase_19 AC 27 ms
18,176 KB
testcase_20 AC 833 ms
21,856 KB
testcase_21 AC 841 ms
22,112 KB
testcase_22 AC 26 ms
17,664 KB
testcase_23 AC 27 ms
17,792 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var max = new int[m];
        var a = new List<int>[m];
        for (int i = 0; i < m; i++) a[i] = new List<int>();
        line = Console.ReadLine().Trim().Split(' ');
        var b = Array.ConvertAll(line, int.Parse);
        for (int i = 0; i < m; i++)
        {
            max[i] = b[i];
            a[i].Add(0);
        }
        var pa = new int[n];
        pa[0] = m;
        var ans = 1;
        Console.WriteLine(ans);
        for (int i = 1; i < n; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            b = Array.ConvertAll(line, int.Parse);
            for (int j = 0; j < m; j++)
            {
                if (b[j] > max[j])
                {
                    foreach (var x in a[j])
                    {
                        pa[x]--;
                        if (pa[x] == 0) ans--;
                    }
                    a[j].Clear();
                    a[j].Add(i);
                    max[j] = b[j];
                    pa[i]++;
                    if (pa[i] == 1) ans++;
                }
                else if (b[j] == max[j])
                {
                    a[j].Add(i);
                    pa[i]++;
                    if (pa[i] == 1) ans++;
                }
            }
        Console.WriteLine(ans);
        }
    }
}
0