제출 #310664

#제출 시각아이디문제언어결과실행 시간메모리
310664LucaDantasArt Exhibition (JOI18_art)C++17
100 / 100
286 ms21112 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<ll,ll>; #define ff first #define ss second #define rall(a) (a).rbegin(), (a).rend() int main() { int n; scanf("%d", &n); vector<pii> a(n); for(auto& it : a) scanf("%lld %lld", &it.ff, &it.ss); sort(rall(a)); // Os caras com maior peso vem na frente ll maior = -0x3f3f3f3f3f3f3f3f, ans = -0x3f3f3f3f3f3f3f3f; for(int i = 0; i < n; i++) { maior = max(maior + a[i].ss, a[i].ss - a[i].ff); ans = max(ans, maior + a[i].ff); } printf("%lld\n", ans); }

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

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