Submission #170404

# Submission time Handle Problem Language Result Execution time Memory
170404 2019-12-25T04:29:22 Z combi1k1 Coin Collecting (JOI19_ho_t4) C++14
0 / 100
2 ms 376 KB
#include<bits/stdc++.h>

using namespace std;

#define ll  long long
#define X   first
#define Y   second

#define all(x)  x.begin(),x.end()
#define sz(x)   (int)x.size()

#define pb      emplace_back

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

    int n;  cin >> n;

    vector<int> row;
    vector<int> col;

    for(int i = 0 ; i < n + n ; ++i)    {
        int x;  cin >> x;
        int y;  cin >> y;

        row.pb(x);
        col.pb(y);
    }

    sort(row.begin(),row.end());
    sort(col.begin(),col.end());

    ll  ans = 0;

    for(int i = 0 ; i < n + n ; ++i)    ans += abs(row[i] - 1 - (i / 2));
    for(int i = 0 ; i < n + n ; ++i)    ans += abs(col[i] - 2 + (i < n));

    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 252 KB Output is correct
4 Correct 2 ms 372 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 252 KB Output is correct
4 Correct 2 ms 372 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 252 KB Output is correct
4 Correct 2 ms 372 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -