Submission #2349774


Source Code Expand

Copy
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 100005;

int n;
int a[N];

int main(){
	n=get();
	fo(i,1,n)a[i]=get();
	sort(a+1,a+1+n);
	int v=abs(a[n]-a[1]*2),key=a[1];
	fo(i,2,n-1)
	if (v>abs(a[n]-a[i]*2))v=abs(a[n]-a[i]*2),key=a[i];
	printf("%d %d\n",a[n],key);
	return 0;
}

Submission Info

Submission Time
Task D - Binomial Coefficients
User samjia2000
Language C++14 (GCC 5.4.1)
Score 400
Code Size 814 Byte
Status AC
Exec Time 15 ms
Memory 640 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 17
Set Name Test Cases
Sample sample1.txt, sample2.txt
All even0.txt, even1.txt, float.txt, odd0.txt, odd1.txt, rnd_0.txt, rnd_1.txt, rnd_2.txt, rnd_3.txt, rnd_4.txt, rnd_5.txt, rnd_6.txt, rnd_7.txt, rnd_8.txt, rnd_9.txt, sample1.txt, sample2.txt
Case Name Status Exec Time Memory
even0.txt AC 14 ms 640 KB
even1.txt AC 14 ms 640 KB
float.txt AC 15 ms 640 KB
odd0.txt AC 14 ms 640 KB
odd1.txt AC 14 ms 640 KB
rnd_0.txt AC 14 ms 640 KB
rnd_1.txt AC 13 ms 512 KB
rnd_2.txt AC 14 ms 640 KB
rnd_3.txt AC 13 ms 512 KB
rnd_4.txt AC 11 ms 512 KB
rnd_5.txt AC 15 ms 640 KB
rnd_6.txt AC 12 ms 512 KB
rnd_7.txt AC 12 ms 512 KB
rnd_8.txt AC 13 ms 640 KB
rnd_9.txt AC 13 ms 640 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB