Submission #670537

#TimeUsernameProblemLanguageResultExecution timeMemory
670537mseebacherArt Exhibition (JOI18_art)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef vector<int> vi; void setIO(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".ans").c_str(), "w", stdout); } #define MAXI (int)1e5 #define LSOne(S) ((S) & -(S)) #define MSB(S) __builtin_clz(S) vector<ll> ft; void solve(){ int n; cin >> n; vector<pair<ll,ll>> bilder; for(int i = 0;i<n;i++){ ll a,b; cin >> a >> b; bilder.push_back({a,b}); } ll maxi = 0; sort(bilder.begin(),bilder.end()); for(int i = 0;i<n;i++){ ll summe = bilder[i].second; for(int j = i+1;j<n;j++){ summe += bilder[j].second; maxi = max(summe+bilder[i].first-bilder[j].first,maxi); } } cout << maxi; } int main(){ ios::sync_with_stdio(0); cin.tie(nullptr); cout << fixed << setprecision(8); int t = 1; //cin >> t; while(t){ solve(); t--; cout << "\n"; } }

Compilation message (stderr)

art.cpp: In function 'void setIO(std::string)':
art.cpp:9:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  freopen((s + ".in").c_str(), "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
art.cpp:10:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  freopen((s + ".ans").c_str(), "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...