Submission #19179979


Source Code Expand

Copy
#include <iostream>
#include <iomanip>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;

bool w_compare(vector<int64_t> v, vector<int64_t> u) {
    return v[3] < u[3];
}

int main(int argc, const char * argv[]) {

    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n;i++) cin >> a[i];
    sort(a.begin(), a.end());
    
    int pmax = 0, pmin = 10000;
    for (int i = 0; i < n / 2; i++) {
        pmax = max(pmax, a[i] + a[n - 1 - i]);
        pmin = min(pmin, a[i] + a[n - 1 - i]);
    }
    
    cout << pmax - pmin << endl;
    
    return 0;
    
}

Submission Info

Submission Time
Task A - Table Tennis
User parsley69
Language C++ (GCC 9.2.1)
Score 100
Code Size 793 Byte
Status AC
Exec Time 7 ms
Memory 3620 KB

Compile Error

./Main.cpp: In function ‘int main(int, const char**)’:
./Main.cpp:19:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
   19 | int main(int argc, const char * argv[]) {
      |          ~~~~^~~~
./Main.cpp:19:33: warning: unused parameter ‘argv’ [-Wunused-parameter]
   19 | int main(int argc, const char * argv[]) {
      |                    ~~~~~~~~~~~~~^~~~~~

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 27
Set Name Test Cases
All 00-sample-00.txt, 00-sample-01.txt, 10-unique-00.txt, 10-unique-01.txt, 10-unique-02.txt, 10-unique-03.txt, 10-unique-04.txt, 20-order-00.txt, 20-order-01.txt, 20-order-02.txt, 20-order-03.txt, 20-order-04.txt, 30-random-00.txt, 30-random-01.txt, 30-random-02.txt, 30-random-03.txt, 30-random-04.txt, 30-random-05.txt, 30-random-06.txt, 30-random-07.txt, 30-random-08.txt, 30-random-09.txt, 30-random-10.txt, 30-random-11.txt, 30-random-12.txt, 30-random-13.txt, 30-random-14.txt
Case Name Status Exec Time Memory
00-sample-00.txt AC 7 ms 3524 KB
00-sample-01.txt AC 2 ms 3600 KB
10-unique-00.txt AC 2 ms 3404 KB
10-unique-01.txt AC 2 ms 3568 KB
10-unique-02.txt AC 2 ms 3560 KB
10-unique-03.txt AC 2 ms 3528 KB
10-unique-04.txt AC 2 ms 3404 KB
20-order-00.txt AC 2 ms 3408 KB
20-order-01.txt AC 2 ms 3416 KB
20-order-02.txt AC 2 ms 3476 KB
20-order-03.txt AC 2 ms 3480 KB
20-order-04.txt AC 2 ms 3528 KB
30-random-00.txt AC 2 ms 3568 KB
30-random-01.txt AC 2 ms 3416 KB
30-random-02.txt AC 2 ms 3564 KB
30-random-03.txt AC 2 ms 3564 KB
30-random-04.txt AC 2 ms 3560 KB
30-random-05.txt AC 2 ms 3604 KB
30-random-06.txt AC 2 ms 3404 KB
30-random-07.txt AC 2 ms 3480 KB
30-random-08.txt AC 2 ms 3620 KB
30-random-09.txt AC 2 ms 3560 KB
30-random-10.txt AC 2 ms 3508 KB
30-random-11.txt AC 2 ms 3528 KB
30-random-12.txt AC 2 ms 3468 KB
30-random-13.txt AC 2 ms 3476 KB
30-random-14.txt AC 1 ms 3524 KB