結果

問題 No.112 ややこしい鶴亀算
ユーザー SSRS
提出日時 2020-08-05 15:03:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 456 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 76,212 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-17 00:35:42
合計ジャッジ時間 1,535 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; i++){
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	if (a[0] == a[N - 1]){
		if (a[0] == (N - 1) * 2){
			cout << N << ' ' << 0 << endl;
		} else {
			cout << 0 << ' ' << N << endl;
		}
	} else {
		int t = lower_bound(a.begin(), a.end(), a[N - 1]) - a.begin();
		cout << N - t << ' ' << t << endl;
	}
}
0