| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1358213 | KALARRY | Ski 2 (JOI24_ski2) | C++20 | 0 ms | 344 KiB |
//chockolateman
#include<bits/stdc++.h>
using namespace std;
int N,K,h[305],c[305];
pair<long long,long long> temp[305];
int main()
{
scanf("%d%d",&N,&K);
h[0] = 305;
for(int i = 1 ; i <= N ; i++)
{
scanf("%d%d",&h[i],&c[i]);
temp[i] = {h[i],c[i]};
}
sort(temp+1,temp+N+1);
long long ans = 0;
for(int i = 2 ; i <= N ; i++)
{
if(temp[i].first == temp[1].first)
{
ans += K;
temp[i].first++;
}
}
long long min_found = temp[1].second;
int l = 1;
int cnt_free = 1;
for(int r = 2 ; r <= N ; r++)
{
while(temp[l+1].first < temp[r].first)
{
l++;
min_found = min(min_found,temp[l].second);
cnt_free++;
}
if(cnt_free)
cnt_free--;
else
ans += min_found;
}
printf("%lld\n",ans);
return 0;
}Compilation message (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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
