結果
| 問題 | No.709 優勝可能性 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-02 16:16:18 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 127 ms / 3,500 ms |
| コード長 | 823 bytes |
| 記録 | |
| コンパイル時間 | 865 ms |
| コンパイル使用メモリ | 75,480 KB |
| 最終ジャッジ日時 | 2025-01-12 13:25:56 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <vector>
void solve() {
int n, m;
std::cin >> n >> m;
std::vector<int> cnt(n, 0), maxs(m, 0);
std::vector<std::vector<int>> bests(m);
int ans = 0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
int x;
std::cin >> x;
if (x > maxs[j]) {
for (auto k : bests[j]) {
if (--cnt[k] == 0) --ans;
}
bests[j].clear();
maxs[j] = x;
}
if (x == maxs[j]) {
if (cnt[i]++ == 0) ++ans;
bests[j].push_back(i);
}
}
std::cout << ans << "\n";
}
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}