Submission #771834

# Submission time Handle Problem Language Result Execution time Memory
771834 2023-07-03T10:18:46 Z 1bin Examination (JOI19_examination) C++14
0 / 100
24 ms 4040 KB
#include <bits/stdc++.h>

using namespace std;

#define all(v) v.begin(), v.end()
typedef long long ll;
const int NMAX = 1e5 + 5;
ll n, x, y, ans, cnt[NMAX][2], a, b;

int main(void){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    cin >> n;
    for(int i = 0; i < 2 * n; i++){
        cin >> x >> y;
        if(x < 1) ans += 1 - x, x = 1;
        else if(x > n) ans += x - n, x = n;
        if(y >= 2) ans += y - 2, y = 1;
        else ans += 1 - y, y = 0;
        cnt[x][y]++;
    }
    for(int i = 1; i <= n; i++){
        a += cnt[i][0] - 1;
        b += cnt[i][1] - 1;
        ans += abs(a + b);
    }
    ans += abs(a);
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 4040 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 4040 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -