Submission #527514

# Submission time Handle Problem Language Result Execution time Memory
527514 2022-02-17T14:26:56 Z yashgupta7337 Best Place (NOI17_bestplace) C++14
3 / 100
22 ms 2192 KB
#include <bits/stdc++.h>
using namespace std;

void solve()
{
    int n;
    cin >> n;

    int minY = INT_MAX, maxY = INT_MIN, minX = INT_MAX, maxX = INT_MIN;
    for (int i = 0; i < n; i++)
    {
        int x, y;
        cin >> x >> y;
        minY = min(minY, y);
        maxY = max(maxY, y);
        minX = min(minX, x);
        maxX = max(maxX, x);
    }
    cout << (maxX + minX) / 2 << " " << (maxY + minY) / 2 << "\n";
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
}
/* stuff you should look for
 * read the problem 3 more times in case of WA :)
 * int overflow, array bounds
 * special cases (n=1?)
 * do something instead of nothing and stay organized
 * WRITE STUFF DOWN
 * DON'T GET STUCK ON ONE APPROACH
 */
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 1336 KB Output is correct
2 Incorrect 15 ms 1424 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 2192 KB Output isn't correct
2 Halted 0 ms 0 KB -