답안 #1079425

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1079425 2024-08-28T14:25:39 Z JooDdae Coin Collecting (JOI19_ho_t4) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int n, x[200200], y[200200], c[100100][2];

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin >> n;
    for(int i=1;i<=n+n;i++) cin >> x[i] >> y[i];

    ll ans = 0, c1 = 0;
    for(int i=1;i<=n+n;i++) {
        int D = min(max(x[i], 1), n);
        ans += abs(D-x[i]);

        if(y[i] >= 2) {
            c[D][0]++, c1++;
            ans += y[i]-2;
        } else {
            c[D][1]++;
            ans += 1-y[i];
        }
    }

    ll S = 0;
    for(int i=1;i<=n;i++) {
        S += c[i][0]+c[i][1]-2;
        ans += abs(S);
    }

    cout << ans + abs(c1-n);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -