| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1328943 | boclobanchat | Coin Collecting (JOI19_ho_t4) | C++20 | 0 ms | 344 KiB |
#include<bits/stdc++.h>
using namespace std;
const int MAXN=2e5+5;
const long long INF=1e18;
pair<long long,long long> A[MAXN];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
long long ans=0,cntx=0,cnty=0;
for(int i=1;i<=n*2;i++)
{
cin>>A[i].first>>A[i].second;
if(A[i].second<=1) cntx++,ans+=1-A[i].second;
else cnty++,ans+=A[i].second-2;
}
sort(A+1,A+n*2+1);
for(int i=1;i<=n*2;i++) ans+=abs(A[i].first-(i+1)/2);
cout<<ans+max(cntx,cnty)-n;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
