結果

問題 No.709 優勝可能性
ユーザー どらら
提出日時 2018-06-29 23:12:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,454 ms / 3,500 ms
コード長 823 bytes
コンパイル時間 1,747 ms
コンパイル使用メモリ 180,192 KB
実行使用メモリ 57,600 KB
最終ジャッジ日時 2024-07-01 00:13:18
合計ジャッジ時間 8,943 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int N, M;
  cin >> N >> M;
  vector<vector<int>> v(N, vector<int>(M));
  vector<int> mx(M, -1);
  vector<map<int,int>> mp(M);
  rep(i,N){
    rep(j,M){
      cin >> v[i][j];
      mx[j] = max(mx[j], v[i][j]);
      mp[j][mx[j]] = i;
    }
  }

  vector<int> ret(N+1,0);
  rep(i,N){
    int x = -1;
    rep(j,M){
      x = max(x, mp[j][v[i][j]]);
    }
    if(i <= x){
      ret[i]++;
      ret[x+1]--;
    }
  }

  int base = 0;
  rep(i,N){
    base += ret[i];
    cout << base << endl;
  }
  
  return 0;
}
0