結果

問題 No.709 優勝可能性
ユーザー とばりとばり
提出日時 2018-09-06 08:03:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,273 bytes
コンパイル時間 1,579 ms
コンパイル使用メモリ 170,108 KB
実行使用メモリ 11,628 KB
最終ジャッジ日時 2024-04-28 22:09:25
合計ジャッジ時間 5,640 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,516 KB
testcase_01 AC 3 ms
9,560 KB
testcase_02 AC 3 ms
9,692 KB
testcase_03 AC 3 ms
9,576 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 3 ms
9,692 KB
testcase_06 AC 3 ms
9,696 KB
testcase_07 AC 3 ms
6,944 KB
testcase_08 AC 3 ms
9,704 KB
testcase_09 AC 3 ms
9,576 KB
testcase_10 WA -
testcase_11 AC 23 ms
6,944 KB
testcase_12 AC 112 ms
10,340 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 3 ms
9,688 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,944 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];

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N, M;
    cin >> N >> M;

    for (int ni = 0; ni < N; ni++)
    {
        for (int mi = 0; mi < M; mi++)
        {
            cin >> R[mi][ni];
            cumR[mi][ni] = R[mi][ni];

            // 本来1回実行すれば十分だが、もう一回for文を書くのが面倒なためここに書く
            cumR[mi][N] = INF;

            if (ni - 1 >= 0)
            {
                cumR[mi][ni] = max(cumR[mi][ni], cumR[mi][ni - 1]);
            }
        }
    }

    vector<int> num(N + 1, 0);
    for (int ni = 0; ni < N; ni++)
    {
        int lb = ni, ub = ni;
        for (int mi = 0; mi < M; mi++)
        {
            ub = max(ub, (int)(upper_bound(cumR[mi], cumR[mi] + N + 1, R[mi][ni]) - cumR[mi]));
        }
        num[lb]++;
        num[ub]--;
    }

    for (int ni = 0; ni < N; ni++)
    {
        if (ni - 1 >= 0)
        {
            num[ni] += num[ni - 1];
        }
        cout << num[ni] << '\n';
    }

    return 0;
}
0