답안 #938158

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
938158 2024-03-05T01:05:04 Z LittleOrange Coin Collecting (JOI19_ho_t4) C++17
0 / 100
1 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
struct pos{
    ll x,y;
    bool operator<(const pos &o) const{
        return x<o.x;
    }
};
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    ll n;
    cin >> n;
    vector<pos> a(n*2);
    for(pos &o : a) cin >> o.x >> o.y;
    sort(a.begin(),a.end());
    ll ans = 0;
    for(ll i = 0;i<n;i++){
        pos u = a[i<<1],v = a[i<<1|1];
        ans += abs((i+1)-u.x)+abs((i+1)-v.x);
        ans += abs(max(u.y,v.y)-2)+abs(min(u.y,v.y)-1);
    }
    cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 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 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 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 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 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 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -