| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 45127 | Pajaraja | Art Exhibition (JOI18_art) | C++17 | 1082 ms | 66344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
pair<long long,long long> a[500007];
map<long long,long long> m;
set<long long> s;
int main()
{
int n,cnt=0;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
long long t1,t2;
scanf("%lld%lld",&t1,&t2);
m[t1]+=t2;
s.insert(t1);
}
while(s.size()>0)
{
long long t=*s.begin();
a[cnt].first=t;
a[cnt++].second=m[t];
s.erase(t);
}
sort(a,a+cnt);
long long sum=0,sol=-1000000000000000000LL,minn=1000000000000000000LL;
for(int i=0;i<cnt;i++)
{
minn=fmin(minn,-a[i].first+sum);
sum+=a[i].second;
sol=fmax(sol,sum-a[i].first-minn);
}
printf("%lld",sol);
}
컴파일 시 표준 에러 (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... | ||||
