# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
244208 | kimbj0709 | Art Exhibition (JOI18_art) | C++14 | 307 ms | 33272 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int no_of_input;
int input1,input2;
vector<pair<int,int> > vect1;
cin >> no_of_input;
for(int i=0;i<no_of_input;i++){
cin >> input1 >> input2;
vect1.push_back({input1,input2});
}
sort(vect1.begin(),vect1.end());
vector<pair<int,int> > vect2;
for(int i=0;i<vect1.size();){
int currpos = i;
int currsum = 0;
while(i<vect1.size()&&vect1[i].f==vect1[currpos].f){
currsum += vect1[i].s;
i++;
}
vect2.push_back({vect1[currpos].f,currsum});
}
int ans = 0;
int curr = 0;
ans = max(ans,vect2[0].s);
for(int i=1;i<vect2.size();i++){
curr += vect2[i-1].s-(vect2[i].f-vect2[i-1].f);
curr = max(curr,(int)0);
ans = max(ans,curr+vect2[i].s);
}
cout << ans;
}
컴파일 시 표준 에러 (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... |