제출 #330798

#제출 시각아이디문제언어결과실행 시간메모리
330798M_WArt Exhibition (JOI18_art)C++14
100 / 100
268 ms14572 KiB
#include <bits/stdc++.h>
using namespace std;
#define ii pair<long long, long long>
ii aw[500500];
long long val[500500];
int main(){
	int N;
	scanf("%d", &N);
	for(int i = 0; i < N; i++)
		scanf("%lld %lld", &aw[i].first, &aw[i].second);
	sort(aw, aw + N);
	val[0] = aw[0].second;
	for(int i = 1; i < N; i++)
		val[i] = (aw[i].second - (aw[i].first - aw[i - 1].first));
	long long curmax = 0, maxmax = INT_MIN;
	for(int i = 0; i < N; i++){
		curmax = max(curmax + val[i], aw[i].second);
		maxmax = max(maxmax, curmax);
	}
	printf("%lld", maxmax);
}

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

art.cpp: In function 'int main()':
art.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |  scanf("%d", &N);
      |  ~~~~~^~~~~~~~~~
art.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |   scanf("%lld %lld", &aw[i].first, &aw[i].second);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...