結果

問題 No.709 優勝可能性
ユーザー とばりとばり
提出日時 2018-09-06 10:43:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 114 ms / 3,500 ms
コード長 1,191 bytes
コンパイル時間 1,951 ms
コンパイル使用メモリ 171,324 KB
実行使用メモリ 5,740 KB
最終ジャッジ日時 2023-08-13 16:40:45
合計ジャッジ時間 5,929 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 41 ms
4,380 KB
testcase_11 AC 19 ms
4,376 KB
testcase_12 AC 83 ms
4,380 KB
testcase_13 AC 83 ms
4,380 KB
testcase_14 AC 74 ms
4,384 KB
testcase_15 AC 69 ms
4,376 KB
testcase_16 AC 67 ms
4,380 KB
testcase_17 AC 70 ms
5,740 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 114 ms
4,380 KB
testcase_21 AC 114 ms
4,380 KB
testcase_22 AC 1 ms
4,384 KB
testcase_23 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using int64 = long long;
using uint64 = unsigned long long;

constexpr int INF = (1 << 28);
constexpr int MAX_N = 100000;
constexpr int MAX_M = 10;

int R[MAX_M][MAX_N], cumR[MAX_M][MAX_N + 1];

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;
}
0