結果

問題 No.709 優勝可能性
ユーザー kyawashellkyawashell
提出日時 2018-06-30 00:49:01
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 529 ms / 3,500 ms
コード長 1,072 bytes
コンパイル時間 1,629 ms
コンパイル使用メモリ 75,748 KB
実行使用メモリ 87,580 KB
最終ジャッジ日時 2023-09-13 15:58:50
合計ジャッジ時間 6,879 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 290 ms
82,356 KB
testcase_11 AC 194 ms
82,268 KB
testcase_12 AC 414 ms
82,416 KB
testcase_13 AC 380 ms
82,312 KB
testcase_14 AC 343 ms
82,268 KB
testcase_15 AC 320 ms
82,476 KB
testcase_16 AC 302 ms
83,156 KB
testcase_17 AC 311 ms
87,580 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 529 ms
81,616 KB
testcase_21 AC 529 ms
81,552 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

typedef long long ll;

ll n,m,r[100010][100];
vector<ll> tops[11];
ll cou[100010];
ll maxi[11];


int main() {
    cin >> n >> m;
    rep(i,n){
        rep(j,m) {
            cin >> r[i][j];
        }
    }

    rep(j,m)tops[j].push_back(0);
    cou[0] = m;
    rep(j,m)maxi[j] = r[0][j];
    ll ans = 1;

    cout << ans << endl;
    rep(i,n) {
        if(i == 0)continue;

        bool f = false;
        rep(j,m)if(maxi[j] <= r[i][j]){f = true;cou[i]++;}

        if(f){
            ans++;
            rep(j,m) {
                if(maxi[j] > r[i][j])continue;
                if(maxi[j] < r[i][j]){
                    maxi[j] = r[i][j];
                    for(auto v : tops[j]) {
                        cou[v]--;
                        if(cou[v] == 0)ans--;
                    }
                    tops[j].clear();
                }
                tops[j].push_back(i);
            }
        }
        cout << ans << endl;

    }

    return 0;
}
0