結果
| 問題 |
No.709 優勝可能性
|
| コンテスト | |
| ユーザー |
とばり
|
| 提出日時 | 2018-09-06 10:44:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 125 ms / 3,500 ms |
| コード長 | 1,057 bytes |
| コンパイル時間 | 1,834 ms |
| コンパイル使用メモリ | 172,624 KB |
| 実行使用メモリ | 5,760 KB |
| 最終ジャッジ日時 | 2024-11-21 12:50:36 |
| 合計ジャッジ時間 | 4,242 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
using uint64 = unsigned long long;
int main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N, M;
cin >> N >> M;
vector<int> deg(N, 0), maxR(M, 0);
vector<stack<int>> tourists(M);
int num = 0;
for (int ni = 0; ni < N; ni++)
{
for (int mi = 0; mi < M; mi++)
{
int R;
cin >> R;
if (maxR[mi] > R)
{
continue;
}
else if (maxR[mi] < R)
{
maxR[mi] = R;
while (!tourists[mi].empty())
{
int t = tourists[mi].top(); tourists[mi].pop();
if (--deg[t] == 0)
{
num--;
}
}
}
tourists[mi].push(ni);
if (++deg[ni] == 1)
{
num++;
}
}
cout << num << '\n';
}
return 0;
}
とばり