結果

問題 No.709 優勝可能性
ユーザー kappybarkappybar
提出日時 2020-04-21 22:58:04
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 496 ms / 3,500 ms
コード長 1,274 bytes
コンパイル時間 2,040 ms
コンパイル使用メモリ 177,952 KB
実行使用メモリ 34,560 KB
最終ジャッジ日時 2024-04-17 19:47:46
合計ジャッジ時間 6,226 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 143 ms
9,216 KB
testcase_11 AC 61 ms
9,088 KB
testcase_12 AC 308 ms
11,264 KB
testcase_13 AC 264 ms
10,776 KB
testcase_14 AC 222 ms
10,624 KB
testcase_15 AC 206 ms
10,880 KB
testcase_16 AC 306 ms
13,696 KB
testcase_17 AC 496 ms
34,560 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 1 ms
6,940 KB
testcase_20 AC 429 ms
10,760 KB
testcase_21 AC 427 ms
10,752 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll =  long long ;
using P = pair<int,int> ;
const int INF = 1e9;
const int MOD = 1000000007;

int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> R(n,vector<int>(m,0));
    rep(i,n)rep(j,m) cin >> R[i][j];
    vector<int> dp(n);
    vector<pair<int,set<int>>> mx(m);
    dp[0] = 1;
    rep(i,m) mx[i] = make_pair(R[0][i],set<int>{0});
    for(int i=1;i<n;i++){
        dp[i] = dp[i-1];
        bool i_in = false;
        rep(j,m){
            if(mx[j].first < R[i][j]){
                for(int p:mx[j].second){
                    bool ok = false;
                    rep(k,m){
                        if(k==j) continue;
                        if(mx[k].second.count(p) > 0){
                            ok = true;
                            break;
                        }
                    }
                    if(!ok) --dp[i];
                }
                i_in = true;
                mx[j] = make_pair(R[i][j],set<int>{i});       
            }else if(mx[j].first == R[i][j]){
                i_in = true;
                mx[j].second.insert(i);
            }
        }
        if(i_in) ++dp[i];
    }

    rep(i,n) cout << dp[i] << '\n';
    return 0;
}
0