結果
| 問題 | 
                            No.709 優勝可能性
                             | 
                    
| コンテスト | |
| ユーザー | 
                             le_panda_noir
                         | 
                    
| 提出日時 | 2020-07-10 23:22:00 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 891 bytes | 
| コンパイル時間 | 2,827 ms | 
| コンパイル使用メモリ | 85,556 KB | 
| 最終ジャッジ日時 | 2025-01-11 19:15:15 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 16 TLE * 6 | 
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <set>
using namespace std;
using vi = vector<int>;
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
int main() {
  int N, M; cin >> N >> M;
  vector<vector<int>> R(N, vi(M));
  rep(i, N) {
    rep(j, M) {
      cin >> R[i][j];
    }
  }
  vi max_R(N, 0);
  vector<vi> maxes(N, vi());
  multiset<int> ans;
  rep(k, N) {
    rep(j, M) {
      if (max_R[j] > R[k][j])
        continue;
      if (max_R[j] == R[k][j]) {
        ans.insert(k);
        maxes[j].push_back(k);
        continue;
      }
      while (!maxes[j].empty()) {
        int v = maxes[j].back(); maxes[j].pop_back();
        ans.erase(ans.lower_bound(v));
      }
      ans.insert(k);
      maxes[j].push_back(k);
      max_R[j] = R[k][j];
    }
    set<int> st;
    for (const auto& e:ans)
      st.insert(e);
    cout << st.size() << endl;
  }
  return 0;
}
            
            
            
        
            
le_panda_noir