제출 #41102

#제출 시각아이디문제언어결과실행 시간메모리
41102abekerArt Exhibition (JOI18_art)C++14
100 / 100
290 ms8556 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair <ll, ll> pii; const int MAXN = 5e5 + 5; const ll INF = 1e18; int N; pii p[MAXN]; void load() { scanf("%d", &N); for (int i = 1; i <= N; i++) scanf("%lld%lld", &p[i].first, &p[i].second); } ll solve() { sort(p + 1, p + N + 1); ll mini = INF, sol = -INF; for (int i = 1; i <= N; i++) { p[i].second += p[i - 1].second; mini = min(mini, p[i - 1].second - p[i].first); sol = max(sol, p[i].second - p[i].first - mini); } return sol; } int main() { load(); printf("%lld\n", solve()); return 0; }

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

art.cpp: In function 'void load()':
art.cpp:14:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
                 ^
art.cpp:16:47: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld", &p[i].first, &p[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...