結果

問題 No.568 じゃんじゃん 落とす 委員会
ユーザー ohreitetsuohreitetsu
提出日時 2017-11-18 12:58:16
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 949 bytes
コンパイル時間 496 ms
コンパイル使用メモリ 59,736 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-05-04 04:34:02
合計ジャッジ時間 3,727 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
10,752 KB
testcase_01 AC 64 ms
5,376 KB
testcase_02 AC 46 ms
5,376 KB
testcase_03 AC 40 ms
5,376 KB
testcase_04 AC 42 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 43 ms
5,376 KB
testcase_07 AC 42 ms
5,376 KB
testcase_08 AC 39 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 41 ms
5,376 KB
testcase_12 AC 61 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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:38:22: warning: overflow in conversion from ‘double’ to ‘int’ changes value from ‘1.0e+10’ to ‘2147483647’ [-Woverflow]
   38 |         int minN3Num=1e10;
      |                      ^~~~

ソースコード

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=1e10;
	for (int sa=0;sa<=maxA+1;sa++){
		for (int sb=maxB+1;sb>=0;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