Submission #96241

#TimeUsernameProblemLanguageResultExecution timeMemory
96241pamajArt Exhibition (JOI18_art)C++14
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> using namespace std; typedef uint64_t ll; const int maxn = 5e5 + 10;; ll n, pref[maxn]; vector<pair<ll, ll>> v; int main() { ios::sync_with_stdio(false), cin.tie(nullptr); cin >> n; for(int i = 0; i < n; i++) { ll a, b; cin >> a >> b; v.push_back({a, b}); } sort(v.begin(), v.end()); // for(int i = 0; i < n; i++) // { // if(!i) pref[i] = v[i].second; // else // { // pref[i] = pref[i - 1] + v[i].second; // } // } ll ans = 0; for(int i = 0; i < n - 1; i++) { ll sum = v[i].second; for(int j = i + 1; j < n; j++) { sum += v[j].second; ans = max(ans, sum - (v[j].first- v[i].first)); } } cout << ans << "\n"; }

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:14:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < n; i++)
                 ~~^~~
art.cpp:34:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < n - 1; i++)
                 ~~^~~~~~~
art.cpp:38:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = i + 1; j < n; j++)
                      ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...