結果

問題 No.568 じゃんじゃん 落とす 委員会
ユーザー ohreitetsuohreitetsu
提出日時 2017-11-18 12:30:36
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 948 bytes
コンパイル時間 710 ms
コンパイル使用メモリ 59,600 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-05-04 04:33:51
合計ジャッジ時間 4,620 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
	int N,M;
	cin>>N>>M;
	vector<int> x(N),a(N),b(N);
	vector<int> xTmp(N);	
	int i;
	int maxA=0;
	int maxB=0;
	int n2Num=0;
	int n3Num=0;
	for (i=0;i<N;i++){
		cin>>x[i]>>a[i]>>b[i];
		if (maxA<a[i]){
			maxA=a[i];
		}
		if (maxB<b[i]){
			maxB=b[i];
		}
		if (x[i]>=2){
			n2Num++;
		}
		if (x[i]>=3){
			n3Num++;
		}
	}
	if (n2Num>=M){
		cout<<n3Num<<endl;
		return 0;
	}
	n2Num=0;
	n3Num=0;
	int SA=0;
	int SB=0;
	int minN3Num=100000;
	for (int sa=0;sa<=maxA;sa++){
		for (int sb=0;sb<=maxB;sb++){		
			n2Num=0;
			n3Num=0;
			for (i=0;i<N;i++){
				xTmp[i]=x[i];
				if (a[i]>=sa){
					xTmp[i]++;
				}
				if (b[i]>=sb){
					xTmp[i]++;
				}
				if (xTmp[i]>=2){
					n2Num++;
				}
				if (xTmp[i]>=3){
					n3Num++;
				}
			}
			if (n2Num==M){
				if (minN3Num>n3Num){
					minN3Num=n3Num;
				}
			}
		}

	}

	cout<<minN3Num<<endl;
	return 0;
}
0