Submission #50708

#TimeUsernameProblemLanguageResultExecution timeMemory
50708ayhcbagnopArt Exhibition (JOI18_art)C++14
100 / 100
301 ms239072 KiB
//Power Of Ninja Go #include <bits/stdc++.h> //#ifdef atom #else #endif using namespace std; typedef long long ll; typedef pair<ll, ll> ii; typedef vector<int> vi; typedef vector< ii > vii; #define X first #define Y second #define pb push_back vii pong; const int maxn = 5e5+5; ll qs[maxn]; ll x[maxn], y[maxn]; int main() { int n; scanf("%d", &n); for(int i = 0; i< n; i++) { pong.pb(ii()); scanf("%lld %lld", &pong.back().X, &pong.back().Y); } sort(pong.begin(), pong.end()); for(int i = 1; i<= n; i++) { qs[i] = qs[i-1] + pong[i-1].Y; } for(int i = 1; i<= n; i++) x[i] = qs[i]-pong[i-1].X; for(int i = 1; i<= n; i++) y[i] = qs[i-1]-pong[i-1].X; //for(int i = 1; i<= n; i++) cout << x[i] << " " << y[i] << endl; ll best = 1e18; ll res = -1e18; for(int i = 1; i<= n; i++) { best = min(best, y[i]); res = max(res, x[i]-best); } printf("%lld\n", res); }

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:15:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int n; scanf("%d", &n);
            ~~~~~^~~~~~~~~~
art.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld", &pong.back().X, &pong.back().Y);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...