結果

問題 No.709 優勝可能性
ユーザー ajiruajiruajiruajiru
提出日時 2020-02-09 02:45:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 543 ms / 3,500 ms
コード長 653 bytes
コンパイル時間 805 ms
コンパイル使用メモリ 73,660 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-08 11:51:15
合計ジャッジ時間 7,489 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 262 ms
6,676 KB
testcase_11 AC 179 ms
6,676 KB
testcase_12 AC 423 ms
6,676 KB
testcase_13 AC 385 ms
6,676 KB
testcase_14 AC 343 ms
6,676 KB
testcase_15 AC 322 ms
6,676 KB
testcase_16 AC 302 ms
6,676 KB
testcase_17 AC 306 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 541 ms
6,676 KB
testcase_21 AC 543 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main(void) {
	int n, m, r;
	cin >> n >> m;
	vector<int> r_max(m, 0), wins(n, 0);
	vector<vector<int> > id(m);
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			cin >> r;
			if (r > r_max[j]) {
				r_max[j] = r;
				++wins[i];
				for (int k = 0; k < id[j].size(); ++k) {
					--wins[id[j][k]];
					if (wins[id[j][k]] == 0) 
						--ans;
				}
				id[j].clear();
				id[j].shrink_to_fit();
				id[j].push_back(i);
			}
			else if (r == r_max[j]) {
				++wins[i];
				id[j].push_back(i);
			}
		}
		if (wins[i] > 0) ++ans;
		cout << ans << endl;
	}
	return 0;
}
0