| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1358207 | 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;
if(N > 1)
{
if(temp[1].first == temp[2].first)
{
temp[1].first--;
ans += K;
}
long long min_found = temp[1].second;
int l = 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);
}
ans += min_found;
}
}
printf("%lld\n",ans);
return 0;
}컴파일 시 표준 에러 (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... | ||||
