結果

問題 No.709 優勝可能性
ユーザー bluemegane
提出日時 2018-09-27 09:26:01
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,236 bytes
コンパイル時間 2,639 ms
コンパイル使用メモリ 110,408 KB
実行使用メモリ 76,080 KB
最終ジャッジ日時 2024-10-12 04:26:51
合計ジャッジ時間 6,871 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other AC * 10 TLE * 1 -- * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;
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);
        }
        print(a, m);
        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]) { a[j].Clear(); a[j].Add(i); max[j] = b[j]; }
                else if (b[j] == max[j]) a[j].Add(i);
            }
            print(a, m);
        }
    }
    public static void print (List<int>[] a  , int m)
    {
        var ans = new List<int>();
        for (int i = 0; i < m; i++)
            ans.AddRange(a[i]);
        Console.WriteLine(ans.Distinct().Count());
    }
}
0