結果

問題 No.709 優勝可能性
ユーザー kakira9618kakira9618
提出日時 2018-06-29 23:25:54
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 643 ms / 3,500 ms
コード長 1,733 bytes
コンパイル時間 828 ms
コンパイル使用メモリ 97,324 KB
実行使用メモリ 38,716 KB
最終ジャッジ日時 2023-09-13 15:41:51
合計ジャッジ時間 6,592 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 253 ms
9,076 KB
testcase_11 AC 176 ms
9,128 KB
testcase_12 AC 400 ms
11,044 KB
testcase_13 AC 373 ms
10,368 KB
testcase_14 AC 327 ms
10,364 KB
testcase_15 AC 319 ms
11,108 KB
testcase_16 AC 418 ms
14,260 KB
testcase_17 AC 643 ms
38,716 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 503 ms
10,504 KB
testcase_21 AC 504 ms
10,520 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> R(N, vector<int>(M));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      cin >> R[i][j];
    }
  }

  vector<int> maR(M, 0);
  vector<set<int>> maP(M);
  set<int> P;
  P.insert(0);
  vector<int> cnt(N, 0);
  for (int j = 0; j < M; j++) {
    maR[j] = R[0][j];
    maP[j].insert(0);
    cnt[0]++;
  }
  cout << 1 << endl;


  for (int i = 1; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (maR[j] < R[i][j]) {
        maR[j] = R[i][j];
        
        for(auto s : maP[j]) {
          cnt[s]--;
          if (cnt[s] == 0) P.erase(s);
        }
        maP[j].clear();

        maP[j].insert(i); 
        P.insert(i);
        
        cnt[i]++;
      } else if (maR[j] == R[i][j]) {
        maP[j].insert(i);
        P.insert(i);
        cnt[i]++;
      }
    }

    cout << P.size() << endl;
  }

  return 0;
}
0