제출 #91876

#제출 시각아이디문제언어결과실행 시간메모리
91876AlisabziArt Exhibition (JOI18_art)C++14
100 / 100
217 ms21100 KiB
#include<bits/stdc++.h>
using namespace std ;
#define F first 
#define S second
typedef long long ll ;
const ll N = 5000011 ;
pair<ll,int> P[N] ;
int n ;
ll a , b, ans;
int main ()
{
	scanf("%d", &n) ;
	for(int i = 1 ; i <= n ; i ++){
		scanf("%lld%lld", &a, &b) ;
		P[i].F = a, P[i].S = b; 
	}
	sort(P+1, P+n+1) ;
	ans = a = P[1].S ;
	b = 0 ;
	for(int i = 2 ; i <= n ; i ++){
		b = max(a+P[i].S-(P[i].F-P[i-1].F), (ll)P[i].S) ; 
		ans = max(ans, b) ;
		a = b ;
	}
	printf("%lld", ans) ;
}

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

art.cpp: In function 'int main()':
art.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n) ;
  ~~~~~^~~~~~~~~~
art.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld", &a, &b) ;
   ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...