| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 125577 | wilwxk | Coin Collecting (JOI19_ho_t4) | C++14 | 2 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=2e3+5;
const ll INF=1e15+9;
vector<ll> v;
int n, cont;
ll respf;
int main() {
scanf("%d", &n); n*=2;
for(int i=1; i<=n; i++) {
int a, b; scanf("%d %d", &a, &b);
if(a<1||a>n) {
if(a<1) respf+=1-a, a=1;
else respf+=a-n, a=n;
}
if(b>=2) cont++;
respf+=min(abs(b-1), abs(b-2));
v.push_back(a);
}
respf+=abs(n/2-cont);
sort(v.begin(), v.end());
int ind=0;
for(int i=0; i<n; i++) {
ll cur=i/2+1;
// printf("adsby %d %lld //%lld\n", cur, ind, respf);
respf+=abs(v[ind++]-cur);
}
printf("%lld\n", respf);
}
컴파일 시 표준 에러 (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... | ||||
