結果

問題 No.709 優勝可能性
ユーザー ohreitetsuohreitetsu
提出日時 2018-10-19 10:42:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,014 bytes
コンパイル時間 875 ms
コンパイル使用メモリ 76,620 KB
実行使用メモリ 13,884 KB
最終ジャッジ日時 2024-04-28 01:04:53
合計ジャッジ時間 10,793 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
typedef long long LL;
int N,M;
int GetWinNum(vector<vector<pair<LL,int>>> &R,vector<bool> &PersonSet)
{
	int num=0;
	for (int j=0;j<M;j++){
		LL maxV=R[j][0].first;
		if (PersonSet[R[j][0].second-1]==false){
			PersonSet[R[j][0].second-1]=true;
			num++;
		}

		for (int i=1;i<R[j].size();i++){
			if (maxV==R[j][i].first){
			if (PersonSet[R[j][i].second-1]==false){
				PersonSet[R[j][i].second-1]=true;
				num++;
			}
			}else{
				break;
			}
		}
	}
	return num;
}
int main(int argc, char* argv[])
{
	cin>>N>>M;
	vector<vector<pair<LL,int>>> R(M);
	vector<LL> maxR(M,0);
	vector<bool> PersonSet(N,false);
	int i,j;
	LL r;
	for (i=0;i<N;i++){
		for (j=0;j<M;j++){
			cin>>r;
			if (r>maxR[j]){
				if (R[j].size()>0){
					R[j].clear();
				}
				R[j].push_back(pair<LL,int>(r,i+1));
				maxR[j]=r;
			}else if (r==maxR[j]){
				R[j].push_back(pair<LL,int>(r,i+1));			
			}
		}
		cout<<GetWinNum(R,PersonSet)<<endl;
	}
	PersonSet.clear();
	return 0;
}
0