結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
10,624 KB
testcase_01 AC 75 ms
5,376 KB
testcase_02 AC 53 ms
5,376 KB
testcase_03 AC 48 ms
5,376 KB
testcase_04 AC 52 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 49 ms
5,376 KB
testcase_07 AC 51 ms
5,376 KB
testcase_08 AC 49 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 51 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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:13:18: warning: overflow in conversion from ‘double’ to ‘int’ changes value from ‘1.0e+10’ to ‘2147483647’ [-Woverflow]
   13 |         int minA=1e10;
      |                  ^~~~
main.cpp:14:18: warning: overflow in conversion from ‘double’ to ‘int’ changes value from ‘1.0e+10’ to ‘2147483647’ [-Woverflow]
   14 |         int minB=1e10;
      |                  ^~~~
main.cpp:46:22: warning: overflow in conversion from ‘double’ to ‘int’ changes value from ‘1.0e+10’ to ‘2147483647’ [-Woverflow]
   46 |         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 minA=1e10;
	int minB=1e10;
	int n2Num=0;
	int n3Num=0;
	for (i=0;i<N;i++){
		cin>>x[i]>>a[i]>>b[i];
		if (minA>a[i]){
			minA=a[i];
		}
		if (maxA<a[i]){
			maxA=a[i];
		}
		if (minB>b[i]){
			minB=b[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=minA-1;sa<=maxA+1;sa++){
		for (int sb=minB-1;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