結果

問題 No.709 優勝可能性
ユーザー ohreitetsuohreitetsu
提出日時 2018-10-18 10:02:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,003 bytes
コンパイル時間 1,013 ms
コンパイル使用メモリ 84,144 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-22 18:10:37
合計ジャッジ時間 6,836 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long LL;
int N,M;
int GetWinNum(vector<multimap<LL,int,greater<LL>>> &R)
{
	int num=0;
	set<int> PersonSet;
	multimap<LL,int,greater<LL>>::iterator mit;
	for (int j=0;j<M;j++){
		mit=R[j].begin();
		LL maxV=(*mit).first;
		for (;mit!=R[j].end();mit++){
			if (maxV==(*mit).first){
				PersonSet.insert((*mit).second);
			}else{
				break;
			}
		}
	}
	num=PersonSet.size();
	PersonSet.clear();
	return num;
}
int main(int argc, char* argv[])
{
	cin>>N>>M;
	vector<multimap<LL,int,greater<LL>>> 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].erase(R[j].begin());
				}
				R[j].insert(multimap<LL,int,greater<LL>>::value_type(r,i+1));
				maxR[j]=r;
			}else if (r==maxR[j]){
				R[j].insert(multimap<LL,int,greater<LL>>::value_type(r,i+1));				
			}
		}
		cout<<GetWinNum(R)<<endl;
	}
	return 0;
}
0