結果
問題 | No.709 優勝可能性 |
ユーザー |
|
提出日時 | 2018-07-12 21:27:36 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 307 ms / 3,500 ms |
コード長 | 1,725 bytes |
コンパイル時間 | 811 ms |
コンパイル使用メモリ | 109,312 KB |
実行使用メモリ | 30,976 KB |
最終ジャッジ日時 | 2024-06-13 01:29:01 |
合計ジャッジ時間 | 4,817 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
import std.stdio, std.string, std.conv; import std.range, std.algorithm, std.array, std.typecons, std.container; import std.math, std.numeric, core.bitop; void main() { int n, m; scan(n, m); auto r = new int[][](n, m); iota(n).each!(i => r[i] = readln.split.to!(int[])); auto risk = new int[](m); auto jogai = new int[][](m, 0); auto stn = new int[](n); int taijo; foreach (i ; 0 .. n) { foreach (j ; 0 .. m) { if (r[i][j] < risk[j]) { stn[i]++; if (stn[i] == m) { taijo++; } } else if (r[i][j] == risk[j]) { jogai[j] ~= i; } else if (r[i][j] > risk[j]) { foreach (jg ; jogai[j]) { stn[jg]++; if (stn[jg] == m) { taijo++; } } jogai[j] = [i]; risk[j] = r[i][j]; } } debug { writeln("taijo:", taijo); writeln(jogai); } writeln(i + 1 - taijo); } } void scan(T...)(ref T args) { import std.stdio : readln; import std.algorithm : splitter; import std.conv : to; import std.range.primitives; auto line = readln().splitter(); foreach (ref arg; args) { arg = line.front.to!(typeof(arg)); line.popFront(); } assert(line.empty); } void fillAll(R, T)(ref R arr, T value) { static if (is(typeof(arr[] = value))) { arr[] = value; } else { foreach (ref e; arr) { fillAll(e, value); } } }