結果

問題 No.112 ややこしい鶴亀算
ユーザー KKT89
提出日時 2020-06-10 08:53:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 533 bytes
コンパイル時間 963 ms
コンパイル使用メモリ 98,888 KB
最終ジャッジ日時 2025-01-11 00:44:51
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<int> x(n);
	for(int i=0;i<n;i++){
		cin >> x[i];
	}
	sort(x.begin(), x.end());
	if(x[0]==x[n-1]){
		if(2*(n-1)==x[0]){
			printf("%d 0\n",n);
		}
		else{
			printf("0 %d\n",n);
		}
	}
	else{
		for(int i=1;i<n;i++){
			if(x[i]>x[i-1]){
				printf("%d %d\n",n-i,i);
				return 0;
			}
		}
	}
}
0