結果

問題 No.709 優勝可能性
ユーザー peroonperoon
提出日時 2019-04-24 13:36:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 248 ms / 3,500 ms
コード長 1,432 bytes
コンパイル時間 1,535 ms
コンパイル使用メモリ 170,288 KB
実行使用メモリ 9,392 KB
最終ジャッジ日時 2023-08-07 14:56:33
合計ジャッジ時間 6,335 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 165 ms
4,376 KB
testcase_11 AC 138 ms
4,380 KB
testcase_12 AC 214 ms
4,376 KB
testcase_13 AC 208 ms
4,376 KB
testcase_14 AC 195 ms
4,380 KB
testcase_15 AC 192 ms
4,380 KB
testcase_16 AC 194 ms
4,928 KB
testcase_17 AC 200 ms
9,392 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 244 ms
4,380 KB
testcase_21 AC 248 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll N, M;
    cin >> N >> M;

    vector<ll> ma(M); // スキル最高値
    vector<vector<ll> > I(M); // スキルごとの最高者のid
    ll ans = 0;
    vector<ll> H(N); // 各人の最高値数

    FOR(i, 0, N){
        bool has_top_skill = false;

        FOR(j, 0, M){
            ll r;
            cin >> r;

            if(r>ma[j]){
                // スキル更新
                ma[j] = r;
                H[i]++;

                // 負けた人たち
                for(ll id : I[j]){
                    H[id]--;
                    if(H[id]==0){
                        ans--;
                    }
                }
                I[j].resize(0);
                I[j].push_back(i);
                has_top_skill = true;
            }
            else if(r==ma[j]){
                H[i]++;
                I[j].push_back(i);
                has_top_skill = true;
            }
        }
        if(has_top_skill){
            ans++;
        }

        p(ans);
    }
    
    return 0;
}
0