結果
| 問題 | No.709 優勝可能性 | 
| コンテスト | |
| ユーザー |  ei1333333 | 
| 提出日時 | 2018-03-26 02:12:41 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 648 ms / 3,500 ms | 
| コード長 | 535 bytes | 
| コンパイル時間 | 2,157 ms | 
| コンパイル使用メモリ | 198,872 KB | 
| 最終ジャッジ日時 | 2025-01-05 09:35:09 | 
| ジャッジサーバーID (参考情報) | judge5 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 22 | 
ソースコード
#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;
  }
}
            
            
            
        