제출 #354360

#제출 시각아이디문제언어결과실행 시간메모리
354360David_MArt Exhibition (JOI18_art)C++14
100 / 100
570 ms21100 KiB
#include<bits/stdc++.h>
#define F first
#define S second
#define ll long long
using namespace std;
ll n, ans, Ans;
pair<ll, ll> p[500005];
int main(){
	cin>>n;
	for(int i=1; i<=n; i++) cin>>p[i].F>>p[i].S;
	sort(p+1, p+n+1);
	
    for(int i=1;i<=n;i++)
        Ans=max(Ans, ans+p[i].S),
        ans=max((ll)0,ans+p[i].S-p[i+1].F+p[i].F);
	
	cout<<Ans;
}

컴파일 시 표준 에러 (stderr) 메시지

art.cpp: In function 'int main()':
art.cpp:13:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   13 |     for(int i=1;i<=n;i++)
      |     ^~~
art.cpp:17:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   17 |  cout<<Ans;
      |  ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...