Submission #703779

# Submission time Handle Problem Language Result Execution time Memory
703779 2023-02-28T11:20:57 Z prietukani Best Place (NOI17_bestplace) C++14
0 / 100
2 ms 340 KB
////* Author : Priet Ukani

////* File : Best_place.cpp
////* Date & Time : 2023-02-28 16:47:44

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define float long double
#define ll long long
#define pb push_back
#define mp make_pair
#define unique(v) (v).erase(unique((v).begin(), (v).end()), (v).end()) // creates a vector containing unique elements in sorted order (sort the vector before using to erase all duplicates) ONLY DELETES CONSECUTIVE same elements
#define size(x) (int)((x).size())
#define all(v) (v).begin(), (v).end()
#define file_open()                   \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define scan_arr(arr, n)          \
    for (int i = 0; i < (n); i++) \
    {                             \
        scanf("%lld", &(arr)[i]); \
    }
#define print_arr(arr, n)          \
    for (int i = 0; i < (n); i++)  \
    {                              \
        printf("%lld ", (arr)[i]); \
    }                              \
    printf("\n");
#define MOD 1000000007          // 1e9+7
#define INF 9223372036854775807 // for long long
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(NULL);                \
    cout.tie(NULL)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
// find_by_order(k) finds kth element, order_of_key(x) count of element less than x

#define sp " "
#define endl '\n'
//* ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~* *//

void solve()
{
    int n;
    cin >> n;
    // vector<pair<int, int>> v;
    int x[n];
    int y[n];
    for (int i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i];
    }
    sort(x, x + n);
    sort(y, y + n);
    cout << x[n / 2] << sp << y[n / 2] << endl;
    return;
}

signed main()
{
    auto start = std::chrono::high_resolution_clock::now();
#ifndef ONLINE_JUDGE
    file_open()
#endif
        fast;
    solve();
    auto end = std::chrono::high_resolution_clock::now();
    auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
#ifndef ONLINE_JUDGE
    std::cout << "Execution time: " << duration << " ms" << endl;
    std::cerr << "Execution time: " << duration << " ms" << endl;
#endif
    return 0;
}

Compilation message

bestplace.cpp: In function 'int main()':
bestplace.cpp:20:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     freopen("input.txt", "r", stdin); \
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bestplace.cpp:67:5: note: in expansion of macro 'file_open'
   67 |     file_open()
      |     ^~~~~~~~~
bestplace.cpp:21:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     freopen("output.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
bestplace.cpp:67:5: note: in expansion of macro 'file_open'
   67 |     file_open()
      |     ^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Unexpected end of file - int64 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Unexpected end of file - int64 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Unexpected end of file - int64 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Unexpected end of file - int64 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Unexpected end of file - int64 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Unexpected end of file - int64 expected
2 Halted 0 ms 0 KB -