結果

問題 No.709 優勝可能性
ユーザー ei1333333ei1333333
提出日時 2018-03-29 23:58:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 508 ms / 3,500 ms
コード長 651 bytes
コンパイル時間 2,041 ms
コンパイル使用メモリ 204,828 KB
実行使用メモリ 9,688 KB
最終ジャッジ日時 2023-09-08 06:51:21
合計ジャッジ時間 7,125 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 254 ms
7,616 KB
testcase_11 AC 173 ms
7,708 KB
testcase_12 AC 399 ms
7,684 KB
testcase_13 AC 359 ms
7,600 KB
testcase_14 AC 324 ms
7,604 KB
testcase_15 AC 302 ms
7,752 KB
testcase_16 AC 286 ms
7,940 KB
testcase_17 AC 292 ms
9,688 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 508 ms
7,724 KB
testcase_21 AC 505 ms
7,696 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;


int main() {
  int N, M, R[100000][10];

  stack< int > st[10];
  int in[100000] = {}, sz = 0;

  cin >> N >> M;
  assert(1 <= N && N <= 100000);
  assert(1 <= M && M <= 10);
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < M; j++) {
      cin >> R[i][j];
      assert(1 <= R[i][j] && R[i][j] <= 1000000000);

      while(!st[j].empty() && R[st[j].top()][j] < R[i][j]) {
        if(--in[st[j].top()] == 0) --sz;
        st[j].pop();
      }

      if(st[j].empty() || R[st[j].top()][j] == R[i][j]) {
        if(++in[i] == 1) ++sz;
        st[j].push(i);
      }
    }
    cout << sz << endl;
  }
}
0