結果

問題 No.1285 ゴミ捨て
ユーザー 👑 horiesinitihoriesiniti
提出日時 2023-02-15 00:28:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 1,812 ms
コンパイル使用メモリ 74,784 KB
実行使用メモリ 12,700 KB
最終ジャッジ日時 2023-09-24 11:04:20
合計ジャッジ時間 4,532 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 125 ms
12,356 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 46 ms
7,196 KB
testcase_10 AC 97 ms
11,184 KB
testcase_11 AC 92 ms
10,472 KB
testcase_12 AC 65 ms
8,632 KB
testcase_13 AC 68 ms
8,624 KB
testcase_14 AC 119 ms
11,860 KB
testcase_15 AC 80 ms
9,552 KB
testcase_16 AC 20 ms
5,180 KB
testcase_17 AC 20 ms
5,036 KB
testcase_18 AC 17 ms
5,004 KB
testcase_19 AC 42 ms
6,972 KB
testcase_20 AC 18 ms
4,756 KB
testcase_21 AC 24 ms
5,476 KB
testcase_22 AC 140 ms
12,680 KB
testcase_23 AC 124 ms
12,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;

map<int,int> ms,ms2;


int main() {
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		ms[a]++;
		ms2[a]++;
	}
	map<int,int>::iterator it,it2;
	for(map<int,int>::iterator it=ms.begin();it!=ms.end();it++){
		int s,c;
		s=(*it).first+1;
		it2=ms2.upper_bound(s);
		if(it2!=ms2.end()){
			(*it2).second--;
			if((*it2).second<=0){
				ms2.erase(it2);
			}
			n--;
		}
	}
	cout<<n<<endl;
	return 0;
}
0