結果

問題 No.709 優勝可能性
ユーザー ei1333333ei1333333
提出日時 2018-03-26 02:12:41
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 504 ms / 3,500 ms
コード長 535 bytes
コンパイル時間 2,151 ms
コンパイル使用メモリ 203,904 KB
実行使用メモリ 9,940 KB
最終ジャッジ日時 2023-09-08 06:51:07
合計ジャッジ時間 8,610 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 252 ms
7,740 KB
testcase_11 AC 174 ms
7,608 KB
testcase_12 AC 396 ms
7,640 KB
testcase_13 AC 365 ms
7,704 KB
testcase_14 AC 324 ms
7,604 KB
testcase_15 AC 301 ms
7,916 KB
testcase_16 AC 286 ms
7,892 KB
testcase_17 AC 289 ms
9,940 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 503 ms
7,652 KB
testcase_21 AC 504 ms
7,680 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 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;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < M; j++) {
      cin >> R[i][j];

      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