Submission #670230

# Submission time Handle Problem Language Result Execution time Memory
670230 2022-12-08T10:50:45 Z Quan2003 Art Exhibition (JOI18_art) C++17
100 / 100
690 ms 21108 KB
#include <bits/stdc++.h>
#include <iostream>
#include<queue>
#include<vector>
#include<utility>
using namespace std;
typedef long long ll;
const int sz=101;
const int sz1=5e5+1;
int n,x,k,i,j,w,m;
ll res=1e18;
ll ans=0;
int movex[4]={0,0,1,-1};
int movey[4]={-1,1,0,0};
long long c[sz1];
vector<ll>adj[sz];
long long pf[sz1];
long long dp[sz1];
vector<pair<long long,int>>pic;
int main(){
      cin>>n;
      pic.push_back({0,0});
      for(int i = 0; i < n; i++){
           long long u,v ;cin>>u>>v;
           pic.push_back({u,v});
      } 
      sort(pic.begin(),pic.end());
      long long sum = 0;
      long long ans = 0; 
      long long mn = LLONG_MAX;
      for( int i = 1 ; i <= n; i++){
            mn = min(mn, sum - pic[i].first);
            sum += pic[i].second;
            ans = max(ans, sum - mn - pic[i].first);
      }
      cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 320 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 320 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 328 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 328 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 324 KB Output is correct
26 Correct 1 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 320 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 328 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 328 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 324 KB Output is correct
26 Correct 1 ms 328 KB Output is correct
27 Correct 5 ms 596 KB Output is correct
28 Correct 6 ms 596 KB Output is correct
29 Correct 6 ms 596 KB Output is correct
30 Correct 5 ms 596 KB Output is correct
31 Correct 5 ms 596 KB Output is correct
32 Correct 5 ms 596 KB Output is correct
33 Correct 5 ms 596 KB Output is correct
34 Correct 5 ms 588 KB Output is correct
35 Correct 5 ms 664 KB Output is correct
36 Correct 6 ms 596 KB Output is correct
37 Correct 5 ms 584 KB Output is correct
38 Correct 5 ms 576 KB Output is correct
39 Correct 5 ms 596 KB Output is correct
40 Correct 5 ms 596 KB Output is correct
41 Correct 5 ms 596 KB Output is correct
42 Correct 5 ms 660 KB Output is correct
43 Correct 5 ms 572 KB Output is correct
44 Correct 5 ms 596 KB Output is correct
45 Correct 5 ms 596 KB Output is correct
46 Correct 5 ms 596 KB Output is correct
47 Correct 5 ms 600 KB Output is correct
48 Correct 5 ms 596 KB Output is correct
49 Correct 5 ms 596 KB Output is correct
50 Correct 6 ms 596 KB Output is correct
51 Correct 5 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 320 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 328 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 328 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 324 KB Output is correct
26 Correct 1 ms 328 KB Output is correct
27 Correct 5 ms 596 KB Output is correct
28 Correct 6 ms 596 KB Output is correct
29 Correct 6 ms 596 KB Output is correct
30 Correct 5 ms 596 KB Output is correct
31 Correct 5 ms 596 KB Output is correct
32 Correct 5 ms 596 KB Output is correct
33 Correct 5 ms 596 KB Output is correct
34 Correct 5 ms 588 KB Output is correct
35 Correct 5 ms 664 KB Output is correct
36 Correct 6 ms 596 KB Output is correct
37 Correct 5 ms 584 KB Output is correct
38 Correct 5 ms 576 KB Output is correct
39 Correct 5 ms 596 KB Output is correct
40 Correct 5 ms 596 KB Output is correct
41 Correct 5 ms 596 KB Output is correct
42 Correct 5 ms 660 KB Output is correct
43 Correct 5 ms 572 KB Output is correct
44 Correct 5 ms 596 KB Output is correct
45 Correct 5 ms 596 KB Output is correct
46 Correct 5 ms 596 KB Output is correct
47 Correct 5 ms 600 KB Output is correct
48 Correct 5 ms 596 KB Output is correct
49 Correct 5 ms 596 KB Output is correct
50 Correct 6 ms 596 KB Output is correct
51 Correct 5 ms 592 KB Output is correct
52 Correct 495 ms 20952 KB Output is correct
53 Correct 479 ms 20916 KB Output is correct
54 Correct 488 ms 20956 KB Output is correct
55 Correct 491 ms 21000 KB Output is correct
56 Correct 470 ms 21004 KB Output is correct
57 Correct 690 ms 20932 KB Output is correct
58 Correct 476 ms 20844 KB Output is correct
59 Correct 473 ms 20892 KB Output is correct
60 Correct 490 ms 20996 KB Output is correct
61 Correct 486 ms 20828 KB Output is correct
62 Correct 475 ms 21016 KB Output is correct
63 Correct 477 ms 21108 KB Output is correct
64 Correct 489 ms 20916 KB Output is correct
65 Correct 476 ms 20900 KB Output is correct
66 Correct 491 ms 20916 KB Output is correct
67 Correct 482 ms 20848 KB Output is correct
68 Correct 481 ms 20944 KB Output is correct