結果
問題 | No.709 優勝可能性 |
ユーザー |
![]() |
提出日時 | 2018-06-30 01:11:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 528 ms / 3,500 ms |
コード長 | 1,243 bytes |
コンパイル時間 | 1,615 ms |
コンパイル使用メモリ | 172,444 KB |
実行使用メモリ | 17,608 KB |
最終ジャッジ日時 | 2024-07-01 00:41:42 |
合計ジャッジ時間 | 6,539 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include "bits/stdc++.h" #define REP(i,n,N) for(ll i=(n); i<(N); i++) #define RREP(i,n,N) for(ll i=(N-1); i>=n; i--) #define CK(n,a,b) ((a)<=(n)&&(n)<(b)) #define ALL(v) (v).begin(),(v).end() #define p(s) cout<<(s)<<endl #define p2(a,b) cout<<(a)<<" "<<(b)<<endl #define v2(T) vector<vector<T>> typedef long long int ll; using namespace std; const ll inf=1e18; ll N,M; ll R[100010][12]; int main(){ while(cin>>N>>M) { ll mp[100010] = {}; ll mx[12]; stack<ll> kouho[12]; REP(i, 0, 11) mx[i] = 0; REP(i, 0, N) { REP(j, 0, M) { cin >> R[i][j]; } } ll ans=0; REP(i, 0, N) { REP(j, 0, M) { if (R[i][j] > mx[j]) { mx[j] = R[i][j]; while(!kouho[j].empty()) { ll ss=kouho[j].top(); kouho[j].pop(); mp[ss]--; if (mp[ss] == 0) ans--; } } if (R[i][j] >= mx[j]) { mp[i]++; if(mp[i]==1) ans++; kouho[j].push(i); } } p(ans); } } return 0; }