Submission #499787

#TimeUsernameProblemLanguageResultExecution timeMemory
499787ccno1Best Place (NOI17_bestplace)C++17
3 / 100
66 ms1580 KiB
#include <bits/stdc++.h>
#include <climits>
#define ll long long int
#define all(x) (x).begin(), (x).end()
const ll inf = LLONG_MAX;

using namespace std;

ll nxt(){
    ll x = 0;
    cin >> x;
    return x;
}

template <typename type>
istream &operator>>(istream &in, vector <type> &vec){
    ll len = vec.size();
    for(int i = 0; i < len; i++){
        in >> vec[i];
    }
    return in;
}

template <typename type>
ostream &operator<<(ostream &out, vector <type> &vec){
    for (auto val : vec){
        out << val << " ";
    }
    return out;
}

ll rond(double a){
    if(a - floor(a) > 0.5){
        return ceil(a);
    }else{
        return floor(a);
    }
}

void testcase(){
    ll n = nxt();
    ll x = 0;
    ll y = 0;
    vector <pair<int , int>> vec(n);                    //remove
    for(int i = 0;i < n ; i++){
        ll first = nxt();
        x += first;
        ll second = nxt();
        y += second;
        vec[i] = make_pair(first, second);              //remove
    }
    x = rond((double)((double)(x) / (double)(n)));
    y = rond((double)((double)(y) / (double)(n)));
    cout << x << " " << y << endl;
}

int main(){
    ios_base::sync_with_stdio;
    cin.tie(0);
    cout.tie(0);
    
    testcase();
    
    return 0;
}













Compilation message (stderr)

bestplace.cpp: In function 'int main()':
bestplace.cpp:58:15: warning: statement is a reference, not call, to function 'std::ios_base::sync_with_stdio' [-Waddress]
   58 |     ios_base::sync_with_stdio;
      |     ~~~~~~~~~~^~~~~~~~~~~~~~~
bestplace.cpp:58:15: warning: statement has no effect [-Wunused-value]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...