結果

問題 No.709 優勝可能性
ユーザー ohreitetsuohreitetsu
提出日時 2018-10-19 11:43:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 777 bytes
コンパイル時間 650 ms
コンパイル使用メモリ 76,528 KB
実行使用メモリ 9,584 KB
最終ジャッジ日時 2023-08-10 17:22:11
合計ジャッジ時間 11,583 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 783 ms
4,380 KB
testcase_11 AC 355 ms
4,376 KB
testcase_12 AC 1,615 ms
4,380 KB
testcase_13 AC 368 ms
4,376 KB
testcase_14 AC 337 ms
4,380 KB
testcase_15 AC 459 ms
4,380 KB
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)
{
	int num=0;
	vector<bool> PersonSet(N,false);
	for (int j=0;j<M;j++){
		for (int i=0;i<R[j].size();i++){
			if (PersonSet[R[j][i].second]==false){
				PersonSet[R[j][i].second]=true;
				num++;
			}
		}
	}
	return num;
}
int main(int argc, char* argv[])
{
	cin>>N>>M;
	vector<vector<pair<LL,int>>> R(M);
	vector<LL> maxR(M,0);
	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));
				maxR[j]=r;
			}else if (r==maxR[j]){
				R[j].push_back(pair<LL,int>(r,i));			
			}
		}
		cout<<GetWinNum(R)<<endl;
	}
	return 0;
}
0