Submission #3269194


Source Code Expand

#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))

typedef long long ll;

int main() {
    int N, A, B;
    vector<int> nums;
    scnd1(N);
    int n;
    rep( i, N) {
        scnd1( n);
        nums.push_back(n);
    }
    
    sort( nums.begin(), nums.end());
    
    A = nums[N-1];
    B = nums[0];
    double d = A*1.0/2;
    
    int i = 1;
    while ( i<N-1 && abs(B-d) > abs(nums[i]-d)) {
        B = nums[i++];
    }
    cout2(A,B);
}

Submission Info

Submission Time
Task D - Binomial Coefficients
User mensan_fukuhara
Language C++14 (Clang 3.8.0)
Score 400
Code Size 1771 Byte
Status AC
Exec Time 19 ms
Memory 892 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 18 ms 892 KB
even1.txt AC 18 ms 892 KB
float.txt AC 19 ms 892 KB
odd0.txt AC 18 ms 892 KB
odd1.txt AC 18 ms 892 KB
rnd_0.txt AC 18 ms 892 KB
rnd_1.txt AC 16 ms 892 KB
rnd_2.txt AC 17 ms 892 KB
rnd_3.txt AC 16 ms 892 KB
rnd_4.txt AC 14 ms 892 KB
rnd_5.txt AC 19 ms 892 KB
rnd_6.txt AC 15 ms 892 KB
rnd_7.txt AC 15 ms 892 KB
rnd_8.txt AC 17 ms 892 KB
rnd_9.txt AC 17 ms 892 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB