結果

問題 No.709 優勝可能性
ユーザー dnishdnish
提出日時 2018-06-30 01:11:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 500 ms / 3,500 ms
コード長 1,243 bytes
コンパイル時間 2,327 ms
コンパイル使用メモリ 171,184 KB
実行使用メモリ 17,608 KB
最終ジャッジ日時 2023-09-13 16:02:12
合計ジャッジ時間 6,563 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 244 ms
13,672 KB
testcase_11 AC 167 ms
13,552 KB
testcase_12 AC 395 ms
13,652 KB
testcase_13 AC 346 ms
13,492 KB
testcase_14 AC 317 ms
13,532 KB
testcase_15 AC 293 ms
13,832 KB
testcase_16 AC 274 ms
14,096 KB
testcase_17 AC 280 ms
17,608 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 500 ms
13,764 KB
testcase_21 AC 499 ms
13,548 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define REP(i,n,N) for(ll i=(n); i<(N); i++)
#define RREP(i,n,N) for(ll i=(N-1); i>=n; i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define p(s) cout<<(s)<<endl
#define p2(a,b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long int ll;
using namespace std;
const ll inf=1e18;

ll N,M;
ll R[100010][12];
int main(){
    while(cin>>N>>M) {
        ll mp[100010] = {};
        ll mx[12];
        stack<ll> kouho[12];
        REP(i, 0, 11) mx[i] = 0;
        REP(i, 0, N) {
            REP(j, 0, M) {
                cin >> R[i][j];
            }
        }
        ll ans=0;
        REP(i, 0, N) {
            REP(j, 0, M) {
                if (R[i][j] > mx[j]) {
                    mx[j] = R[i][j];
                    while(!kouho[j].empty()) {
                        ll ss=kouho[j].top(); kouho[j].pop();
                        mp[ss]--;
                        if (mp[ss] == 0) ans--;
                    }
                }
                if (R[i][j] >= mx[j]) {
                    mp[i]++;
                    if(mp[i]==1) ans++;
                    kouho[j].push(i);
                }
            }
            p(ans);
        }
    }
    return 0;
}
0