| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 1079727 | _rain_ | Coin Collecting (JOI19_ho_t4) | C++14 | 42 ms | 5044 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fixbug true
void SETIO(string name = ""){
    if (name=="") return;
    freopen((name+".inp").c_str(),"r",stdin);
//    freopen((name+".out").c_str(),"w",stdout);
    return;
}
const int maxn = 2e5;
int in[maxn+2][3] = {} , n;
ll ans = 0 , cur[3];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    SETIO("");
    cin >> n;
    ll ans = 0;
    for (int i = 1; i <= 2*n; ++i)  {
        int x , y; cin >> x >> y;
        if (x < 1) ans += abs(1 - x) , x = 1;
        if (x > n) ans += abs(x - n) , x = n;
        if (y < 1) ans += abs(y - 1) , y = 1;
        if (y > 2) ans += abs(y - 2) , y = 2;
        in[x][y]++;
    }
    for (int i = 1; i <= n; ++i){
        cur[1] += in[i][1] - 1;
        cur[2] += in[i][2] - 1;
        if (cur[2] * cur[1] < 0){
            ll x = min(abs(cur[2]) , abs(cur[1]));
            if (cur[2] > 0){
                cur[2] -= x;
                cur[1] += x;
                ans += x;
            }
            else{
                cur[2] += x;
                cur[1] -= x;
                ans += x;
            }
        }
        ans += abs(cur[2]) + abs(cur[1]);
    }
    cout << ans;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
