結果

問題 No.335 門松宝くじ
ユーザー fiordfiord
提出日時 2016-01-15 23:04:22
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 584 bytes
コンパイル時間 1,792 ms
コンパイル使用メモリ 161,596 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 23:32:26
合計ジャッジ時間 13,166 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 267 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 1,127 ms
4,348 KB
testcase_08 AC 584 ms
4,348 KB
testcase_09 AC 1,695 ms
4,348 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
bool ok(int a,int b,int c){
	if(a==b||b==c||c==a)	return false;
	int m=max(a,max(b,c)),M=min(a,min(b,c));
	if(b==m||b==M)	return true;
	return false;
}
int main(){
	int n,m;	cin>>n>>m;
	int ans=0,score=0;
	for(int i=0;i<m;i++){
		vector<int> a(n);
		for(int j=0;j<n;j++)	cin>>a[j];
		int tmp=0;
		for(int j=0;j<n;j++){
			for(int k=j+1;k<n;k++){
				for(int l=k+1;l<n;l++){
					if(ok(a[j],a[k],a[l])){
						tmp+=max(a[j],max(a[k],a[l]));
					}
				}
			}
		}
		if(score<tmp){
			ans=i;	score=tmp;
		}
	}
	cout<<ans<<endl;
	return 0;
}
0