| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1287712 | herominhsteve | Art Exhibition (JOI18_art) | C++20 | 161 ms | 8340 KiB |
#include <bits/stdc++.h>
#define el '\n'
#define FNAME "JOI18_art"
#define allof(x) x.begin(),x.end()
#define allof1(x) x.begin()+1,x.end()
#define mset(x,n) memset(x,(n),sizeof(x))
using namespace std;
const long long MOD = (long long) 1e9 + 7;
template<class X,class Y> bool minimize(X &a,Y b){ if (a>b) {a=b; return true;} return false;}
template<class X,class Y> bool maximize(X &a,Y b){ if (a<b) {a=b; return true;} return false;}
void setup(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
if (fopen(FNAME".inp","r")){
freopen(FNAME".inp","r",stdin);
freopen(FNAME".out","w",stdout);
}
}
int n;
vector<pair<long long,long long>> pic;
void init(){
cin>>n;
pic.resize(n);
for (pair<long long,long long> &x : pic) cin>>x.first>>x.second;
sort(allof(pic));
}
void sol(){
long long res=0,low=0,sum=0;
for (const pair<long long,long long> &x : pic){
minimize(low,sum - x.first);
sum += x.second;
maximize(res,sum - x.first - low);
}
cout<<res;
}
int main(){
setup();
init();
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... | ||||
