結果
問題 | No.709 優勝可能性 |
ユーザー |
![]() |
提出日時 | 2018-06-30 00:49:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 516 ms / 3,500 ms |
コード長 | 1,072 bytes |
コンパイル時間 | 603 ms |
コンパイル使用メモリ | 74,420 KB |
最終ジャッジ日時 | 2025-01-06 11:47:13 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include<iostream>#include<vector>#include<string>using namespace std;#define rep(i,n) for(int i=0;i<(n);i++)typedef long long ll;ll n,m,r[100010][100];vector<ll> tops[11];ll cou[100010];ll maxi[11];int main() {cin >> n >> m;rep(i,n){rep(j,m) {cin >> r[i][j];}}rep(j,m)tops[j].push_back(0);cou[0] = m;rep(j,m)maxi[j] = r[0][j];ll ans = 1;cout << ans << endl;rep(i,n) {if(i == 0)continue;bool f = false;rep(j,m)if(maxi[j] <= r[i][j]){f = true;cou[i]++;}if(f){ans++;rep(j,m) {if(maxi[j] > r[i][j])continue;if(maxi[j] < r[i][j]){maxi[j] = r[i][j];for(auto v : tops[j]) {cou[v]--;if(cou[v] == 0)ans--;}tops[j].clear();}tops[j].push_back(i);}}cout << ans << endl;}return 0;}