結果

問題 No.709 優勝可能性
ユーザー fura
提出日時 2020-05-22 02:15:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 163 ms / 3,500 ms
コード長 570 bytes
コンパイル時間 2,468 ms
コンパイル使用メモリ 198,016 KB
最終ジャッジ日時 2025-01-10 13:46:43
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         int n,m; scanf("%d%d",&n,&m);
      |                  ~~~~~^~~~~~~~~~~~~~
main.cpp:10:32: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         rep(i,n) rep(j,m) scanf("%d",&a[i][j]);
      |                           ~~~~~^~~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n,m; scanf("%d%d",&n,&m);
	vector<vector<int>> a(n,vector<int>(m));
	rep(i,n) rep(j,m) scanf("%d",&a[i][j]);

	int ans=0;
	vector<int> cnt(n),mx(m);
	vector<vector<int>> L(m);
	rep(i,n){
		rep(j,m){
			if(a[i][j]>mx[j]){
				mx[j]=a[i][j];
				for(int k:L[j]){
					cnt[k]--;
					if(cnt[k]==0) ans--;
				}
				L[j].clear();
			}
			if(a[i][j]==mx[j]){
				L[j].emplace_back(i);
				cnt[i]++;
			}
		}
		if(cnt[i]>0) ans++;
		printf("%d\n",ans);
	}

	return 0;
}
0