結果
| 問題 | No.709 優勝可能性 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-10-19 15:14:08 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 129 ms / 3,500 ms |
| コード長 | 745 bytes |
| 記録 | |
| コンパイル時間 | 1,583 ms |
| コンパイル使用メモリ | 220,176 KB |
| 実行使用メモリ | 15,104 KB |
| 最終ジャッジ日時 | 2026-06-07 02:25:35 |
| 合計ジャッジ時間 | 4,247 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios::sync_with_stdio(false);
int N, M;
cin >> N >> M;
vector<vector<int>> R(N, vector<int>(M));
for (int i = 0; i < N; ++i)
for (int j = 0; j < M; ++j)
cin >> R[i][j];
int ans = 0;
vector<int> stats(N);
vector<stack<pair<int, int>>> stks(M);
for (int i = 0; i < N; ++i) {
for (int j = 0; j < M; ++j) {
for (; stks[j].size() && stks[j].top().first < R[i][j]; stks[j].pop()) {
if (--stats[stks[j].top().second] == 0) --ans;
}
if (stks[j].empty() || R[i][j] == stks[j].top().first) {
++stats[i];
stks[j].emplace(R[i][j], i);
}
}
if (stats[i]) ++ans;
cout << ans << endl;
}
return 0;
}