結果

問題 No.709 優勝可能性
ユーザー dnish
提出日時 2018-06-30 01:04:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 828 ms / 3,500 ms
コード長 1,168 bytes
コンパイル時間 1,901 ms
コンパイル使用メモリ 180,160 KB
実行使用メモリ 42,720 KB
最終ジャッジ日時 2024-07-01 00:41:34
合計ジャッジ時間 7,700 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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) {
        map<ll,ll> mp;
        ll mx[12];
        set<ll> kouho[12];
        REP(i, 0, 11) mx[i] = 0;
        REP(i, 0, N) {
            REP(j, 0, M) {
                cin >> R[i][j];
            }
        }
        REP(i, 0, N) {
            REP(j, 0, M) {
                if (R[i][j] > mx[j]) {
                    mx[j] = R[i][j];
                    for (auto ss: kouho[j]) {
                        mp[ss]--;
                        if (mp[ss] == 0) mp.erase(ss);
                    }
                    kouho[j].clear();
                }
                if (R[i][j] == mx[j]) {
                    kouho[j].insert(i);
                    mp[i]++;
                }
            }
            p(mp.size());
        }
    }
    return 0;
}
0