Submission #1034006

#TimeUsernameProblemLanguageResultExecution timeMemory
1034006cowwycowArt Exhibition (JOI18_art)C++14
100 / 100
149 ms20564 KiB
#pragma GCC optimize("O3,unroll-loops") #include <bits/stdc++.h> using namespace std; #define name "aaaaaa" using ll = long long; using pll = pair<ll, ll>; using ld = long double; void file(){ ios_base::sync_with_stdio(0); cin.tie(0); if(fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); } } const int maxn = 5e5 + 5; pll a[maxn]; ll pre[maxn]; void solve (){ int n; cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i].first >> a[i].second; } sort(a + 1, a + n + 1); for(int i = 1; i <= n; i++){ a[i].second = a[i - 1].second + a[i].second; } ll dis = 1e18, res = 0; for(int i = 1; i <= n; i++){ dis = min(dis, a[i - 1].second - a[i].first); res = max(res, a[i].second - a[i].first - dis); } cout << res; } int main(){ file(); int t = 1; //cin >> t; while(t--){ solve(); } }

Compilation message (stderr)

art.cpp: In function 'void file()':
art.cpp:12:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         freopen(name".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
art.cpp:13:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         freopen(name".out", "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...