結果

問題 No.709 優勝可能性
ユーザー le_panda_noirle_panda_noir
提出日時 2020-07-10 23:22:00
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 891 bytes
コンパイル時間 1,608 ms
コンパイル使用メモリ 89,412 KB
実行使用メモリ 18,720 KB
最終ジャッジ日時 2024-04-19 23:51:49
合計ジャッジ時間 7,665 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
13,888 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0