結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 172 ms
6,676 KB
testcase_11 AC 149 ms
6,676 KB
testcase_12 AC 222 ms
6,676 KB
testcase_13 AC 226 ms
6,676 KB
testcase_14 AC 212 ms
6,676 KB
testcase_15 AC 206 ms
6,676 KB
testcase_16 AC 203 ms
6,676 KB
testcase_17 AC 208 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 259 ms
6,676 KB
testcase_21 AC 260 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) {
    cin.tie(0);
	ios::sync_with_stdio(false);
	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].emplace_back(i);
			}
			else if (r == r_max[j]) {
				++wins[i];
				id[j].emplace_back(i);
			}
		}
		if (wins[i] > 0) ++ans;
		cout << ans << endl;
	}
	return 0;
}
0