| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1355327 | kmath628 | 금 캐기 (IZhO14_divide) | C++20 | 19 ms | 4340 KiB |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100009;
typedef long long ll;
ll x[MAXN], g[MAXN], d[MAXN];
int main(){
int n,i;
ll mx=0;
vector<pair<ll,ll> > a;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%lld %lld %lld",&x[i],&g[i],&d[i]);
g[i]+=g[i-1];
d[i]+=d[i-1];
while(!a.empty() && a.back().first>=x[i]-d[i]) a.pop_back();
a.push_back({x[i]-d[i],g[i]});
}
for(i=1;i<=n;i++){
auto it=upper_bound(a.begin(),a.end(),make_pair(x[i]-d[i-1],0ll));
it--;
mx=max(mx,it->second-g[i-1]);
}
printf("%lld\n",mx);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
