Submission #1108585

#TimeUsernameProblemLanguageResultExecution timeMemory
1108585vjudge1Art Exhibition (JOI18_art)C++17
100 / 100
361 ms8276 KiB
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define priority_queue priority_queue<array<long long,2>, vector<array<long long,2>>, greater<array<long long,2>>> #define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> #define ll long long #define pii pair<int,int> #define pli pair<long long,int> #define pil pair<int,long long> #define pll pair<long long,long long> #define pi 3.14159265358979323846 #define pb push_back #define fi first #define se second #define ar array #define int long long void chay() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define task "Hi" freopen(task".INP", "r", stdin); freopen(task".OUT", "w", stdout); } const int N = 5e5, INF = 2e9+7; const int block = 600; const long long INFLL = 2e18+7; long long M = 1e9+7; int n; ar<int,2> a[N+5]; void solve() { cin>>n; for (int i = 1; i <= n; i++) { cin>>a[i][0]>>a[i][1]; } sort(a+1, a+n+1); int d = -a[1][0], kq = a[1][1], tong = 0; for (int i = 1; i <= n; i++) { tong += a[i][1]; kq = max(kq, tong - a[i][0] - d); d = min(d, tong - a[i+1][0]); } cout<<kq; } signed main () { //chay(); int t = 1; //cin>>t; while (t--) { solve(); } return 0; }

Compilation message (stderr)

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