結果

問題 No.709 優勝可能性
ユーザー ama_nukoama_nuko
提出日時 2018-07-10 13:08:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 511 ms / 3,500 ms
コード長 1,365 bytes
コンパイル時間 992 ms
コンパイル使用メモリ 98,980 KB
実行使用メモリ 8,108 KB
最終ジャッジ日時 2023-09-27 11:34:03
合計ジャッジ時間 6,092 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 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,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 248 ms
4,380 KB
testcase_11 AC 173 ms
4,380 KB
testcase_12 AC 400 ms
4,376 KB
testcase_13 AC 362 ms
4,380 KB
testcase_14 AC 321 ms
4,380 KB
testcase_15 AC 300 ms
4,376 KB
testcase_16 AC 282 ms
4,600 KB
testcase_17 AC 290 ms
8,108 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 511 ms
4,376 KB
testcase_21 AC 508 ms
4,376 KB
testcase_22 AC 1 ms
4,384 KB
testcase_23 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

signed main(){
    int n, m;
    cin >> n >> m;

    vector<vector<int>> win(m, vector<int>());
    vector<int> max(m, 0);
    vector<int> cnt(n+1, 0);
    int ans = 0;
    rep(i, n){
        rep(j, m){
            int r;
            cin >> r;

            if(max[j] < r){
                for(int k: win[j]){
                    cnt[k]--;
                    if(cnt[k] == 0){
                        ans--;
                    }
                }

                max[j] = r;
                win[j] = vector<int>();
                win[j].push_back(i);
                cnt[i]++;
                if(cnt[i] == 1){
                    ans++;
                }
                continue;
            }
            if(max[j] == r){
                win[j].push_back(i);
                cnt[i]++;
                if(cnt[i] == 1){
                    ans++;
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}
0