Submission #718476

#TimeUsernameProblemLanguageResultExecution timeMemory
718476shoryu386Art Exhibition (JOI18_art)C++17
0 / 100
1 ms220 KiB
#include <bits/stdc++.h> using namespace std; #define int long long main(){ int n; cin >> n; pair<int, int> szVal[n]; for (int x = 0; x < n; x++) cin >> szVal[x].first >> szVal[x].second; sort(szVal, szVal+n); int l = 0, r = 0; int psum[n]; psum[0] = szVal[0].second; for (int x = 1; x < n; x++) psum[x] = psum[x-1] + szVal[x].second; int ans = LONG_LONG_MIN; for (int x = 0; x < n; x++){ for (int y = x; y < n; y++){ int sm = psum[y] - (szVal[y].second - szVal[x].second); if (x != 0) sm -= psum[x-1]; ans = max(ans, sm); } } cout << ans; }

Compilation message (stderr)

art.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
art.cpp: In function 'int main()':
art.cpp:11:6: warning: unused variable 'l' [-Wunused-variable]
   11 |  int l = 0, r = 0;
      |      ^
art.cpp:11:13: warning: unused variable 'r' [-Wunused-variable]
   11 |  int l = 0, r = 0;
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...