제출 #700062

#제출 시각아이디문제언어결과실행 시간메모리
700062dsyzArt Exhibition (JOI18_art)C++17
0 / 100
0 ms212 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define MAXN (1000005) int main() { ios_base::sync_with_stdio(false);cin.tie(0); ll N; cin>>N; pair<long double,long double> arr[N]; long double maximum = 0; for(ll i = 0;i < N;i++){ cin>>arr[i].first>>arr[i].second; maximum = max(maximum,arr[i].second); } sort(arr,arr + N); ll ptr = 0; long double cur = arr[0].second; for(ll i = 1;i < N;i++){ cur += arr[i].second; cur -= (arr[i].first - arr[i - 1].first); while(ptr < i){ if(cur + (arr[ptr + 1].first - arr[ptr].first) - arr[ptr].second > cur){ cur += (arr[ptr + 1].first - arr[ptr].first) - arr[ptr].second; ptr++; }else{ break; } } maximum = max(maximum,cur); } cout<<maximum<<'\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...