# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41582 | 2018-02-19T13:46:33 Z | OneSubmissionMan | Art Exhibition (JOI18_art) | C++11 | 217 ms | 8636 KB |
# include <bits/stdc++.h> # define F first # define S second # define mp make_pair // everything go according to my plan # define pb push_back # define sz(a) (int)(a.size()) # define vec vector // shimkenttin kyzdary, dzyn, dzyn, dzyn... # define y1 Y_U_NO_y1 # define left Y_U_NO_left # define right Y_U_NO_right using namespace std; typedef pair <int, int> pii; typedef long long ll; typedef long double ld; const int Mod = (int)1e9 + 7; const int MX = 1073741822; const ll MXLL = 4e18; const int Sz = 1110111; // a pinch of soul inline void Read_rap () { ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0); } inline void randomizer3000 () { unsigned int seed; asm ("rdtsc" : "=A"(seed)); srand (seed); } void files (string problem) { if (fopen ((problem + ".in").c_str(),"r")) { freopen ((problem + ".in").c_str(),"r",stdin); freopen ((problem + ".out").c_str(),"w",stdout); } } void localInput (string in = "s") { if (fopen (in.c_str(), "r")) freopen (in.c_str(), "r", stdin); else { cerr << "Input file not found" << endl; } } int n; pair <ll, ll> a[Sz]; int main() { Read_rap(); //localInput(); cin >> n; for (int i = 1; i <= n; i++) cin >> a[i].F >> a[i].S; sort (a + 1, a + n + 1); ll mn = 0, ans = 0, prefB = 0; for (int i = 1; i <= n; i++) { mn = min (mn, prefB - a[i].F); prefB += a[i].S; ans = max (ans, prefB - mn - a[i].F); } cout << ans; return 0; } // Coded by Z..
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 248 KB | Output is correct |
2 | Correct | 1 ms | 352 KB | Output is correct |
3 | Correct | 1 ms | 424 KB | Output is correct |
4 | Correct | 1 ms | 440 KB | Output is correct |
5 | Correct | 1 ms | 440 KB | Output is correct |
6 | Correct | 2 ms | 476 KB | Output is correct |
7 | Correct | 2 ms | 476 KB | Output is correct |
8 | Correct | 1 ms | 476 KB | Output is correct |
9 | Correct | 2 ms | 476 KB | Output is correct |
10 | Correct | 2 ms | 532 KB | Output is correct |
11 | Correct | 2 ms | 604 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 248 KB | Output is correct |
2 | Correct | 1 ms | 352 KB | Output is correct |
3 | Correct | 1 ms | 424 KB | Output is correct |
4 | Correct | 1 ms | 440 KB | Output is correct |
5 | Correct | 1 ms | 440 KB | Output is correct |
6 | Correct | 2 ms | 476 KB | Output is correct |
7 | Correct | 2 ms | 476 KB | Output is correct |
8 | Correct | 1 ms | 476 KB | Output is correct |
9 | Correct | 2 ms | 476 KB | Output is correct |
10 | Correct | 2 ms | 532 KB | Output is correct |
11 | Correct | 2 ms | 604 KB | Output is correct |
12 | Correct | 2 ms | 604 KB | Output is correct |
13 | Correct | 1 ms | 604 KB | Output is correct |
14 | Correct | 2 ms | 604 KB | Output is correct |
15 | Correct | 2 ms | 712 KB | Output is correct |
16 | Correct | 1 ms | 712 KB | Output is correct |
17 | Correct | 2 ms | 712 KB | Output is correct |
18 | Correct | 2 ms | 712 KB | Output is correct |
19 | Correct | 1 ms | 712 KB | Output is correct |
20 | Correct | 2 ms | 712 KB | Output is correct |
21 | Correct | 1 ms | 712 KB | Output is correct |
22 | Correct | 1 ms | 712 KB | Output is correct |
23 | Correct | 1 ms | 712 KB | Output is correct |
24 | Correct | 1 ms | 712 KB | Output is correct |
25 | Correct | 1 ms | 712 KB | Output is correct |
26 | Correct | 2 ms | 712 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 248 KB | Output is correct |
2 | Correct | 1 ms | 352 KB | Output is correct |
3 | Correct | 1 ms | 424 KB | Output is correct |
4 | Correct | 1 ms | 440 KB | Output is correct |
5 | Correct | 1 ms | 440 KB | Output is correct |
6 | Correct | 2 ms | 476 KB | Output is correct |
7 | Correct | 2 ms | 476 KB | Output is correct |
8 | Correct | 1 ms | 476 KB | Output is correct |
9 | Correct | 2 ms | 476 KB | Output is correct |
10 | Correct | 2 ms | 532 KB | Output is correct |
11 | Correct | 2 ms | 604 KB | Output is correct |
12 | Correct | 2 ms | 604 KB | Output is correct |
13 | Correct | 1 ms | 604 KB | Output is correct |
14 | Correct | 2 ms | 604 KB | Output is correct |
15 | Correct | 2 ms | 712 KB | Output is correct |
16 | Correct | 1 ms | 712 KB | Output is correct |
17 | Correct | 2 ms | 712 KB | Output is correct |
18 | Correct | 2 ms | 712 KB | Output is correct |
19 | Correct | 1 ms | 712 KB | Output is correct |
20 | Correct | 2 ms | 712 KB | Output is correct |
21 | Correct | 1 ms | 712 KB | Output is correct |
22 | Correct | 1 ms | 712 KB | Output is correct |
23 | Correct | 1 ms | 712 KB | Output is correct |
24 | Correct | 1 ms | 712 KB | Output is correct |
25 | Correct | 1 ms | 712 KB | Output is correct |
26 | Correct | 2 ms | 712 KB | Output is correct |
27 | Correct | 3 ms | 712 KB | Output is correct |
28 | Correct | 3 ms | 712 KB | Output is correct |
29 | Correct | 4 ms | 712 KB | Output is correct |
30 | Correct | 5 ms | 712 KB | Output is correct |
31 | Correct | 3 ms | 712 KB | Output is correct |
32 | Correct | 3 ms | 712 KB | Output is correct |
33 | Correct | 5 ms | 712 KB | Output is correct |
34 | Correct | 3 ms | 712 KB | Output is correct |
35 | Correct | 4 ms | 712 KB | Output is correct |
36 | Correct | 3 ms | 712 KB | Output is correct |
37 | Correct | 3 ms | 712 KB | Output is correct |
38 | Correct | 3 ms | 712 KB | Output is correct |
39 | Correct | 3 ms | 712 KB | Output is correct |
40 | Correct | 4 ms | 712 KB | Output is correct |
41 | Correct | 3 ms | 712 KB | Output is correct |
42 | Correct | 4 ms | 712 KB | Output is correct |
43 | Correct | 3 ms | 744 KB | Output is correct |
44 | Correct | 3 ms | 744 KB | Output is correct |
45 | Correct | 3 ms | 744 KB | Output is correct |
46 | Correct | 3 ms | 744 KB | Output is correct |
47 | Correct | 3 ms | 744 KB | Output is correct |
48 | Correct | 4 ms | 744 KB | Output is correct |
49 | Correct | 5 ms | 744 KB | Output is correct |
50 | Correct | 4 ms | 744 KB | Output is correct |
51 | Correct | 3 ms | 744 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 248 KB | Output is correct |
2 | Correct | 1 ms | 352 KB | Output is correct |
3 | Correct | 1 ms | 424 KB | Output is correct |
4 | Correct | 1 ms | 440 KB | Output is correct |
5 | Correct | 1 ms | 440 KB | Output is correct |
6 | Correct | 2 ms | 476 KB | Output is correct |
7 | Correct | 2 ms | 476 KB | Output is correct |
8 | Correct | 1 ms | 476 KB | Output is correct |
9 | Correct | 2 ms | 476 KB | Output is correct |
10 | Correct | 2 ms | 532 KB | Output is correct |
11 | Correct | 2 ms | 604 KB | Output is correct |
12 | Correct | 2 ms | 604 KB | Output is correct |
13 | Correct | 1 ms | 604 KB | Output is correct |
14 | Correct | 2 ms | 604 KB | Output is correct |
15 | Correct | 2 ms | 712 KB | Output is correct |
16 | Correct | 1 ms | 712 KB | Output is correct |
17 | Correct | 2 ms | 712 KB | Output is correct |
18 | Correct | 2 ms | 712 KB | Output is correct |
19 | Correct | 1 ms | 712 KB | Output is correct |
20 | Correct | 2 ms | 712 KB | Output is correct |
21 | Correct | 1 ms | 712 KB | Output is correct |
22 | Correct | 1 ms | 712 KB | Output is correct |
23 | Correct | 1 ms | 712 KB | Output is correct |
24 | Correct | 1 ms | 712 KB | Output is correct |
25 | Correct | 1 ms | 712 KB | Output is correct |
26 | Correct | 2 ms | 712 KB | Output is correct |
27 | Correct | 3 ms | 712 KB | Output is correct |
28 | Correct | 3 ms | 712 KB | Output is correct |
29 | Correct | 4 ms | 712 KB | Output is correct |
30 | Correct | 5 ms | 712 KB | Output is correct |
31 | Correct | 3 ms | 712 KB | Output is correct |
32 | Correct | 3 ms | 712 KB | Output is correct |
33 | Correct | 5 ms | 712 KB | Output is correct |
34 | Correct | 3 ms | 712 KB | Output is correct |
35 | Correct | 4 ms | 712 KB | Output is correct |
36 | Correct | 3 ms | 712 KB | Output is correct |
37 | Correct | 3 ms | 712 KB | Output is correct |
38 | Correct | 3 ms | 712 KB | Output is correct |
39 | Correct | 3 ms | 712 KB | Output is correct |
40 | Correct | 4 ms | 712 KB | Output is correct |
41 | Correct | 3 ms | 712 KB | Output is correct |
42 | Correct | 4 ms | 712 KB | Output is correct |
43 | Correct | 3 ms | 744 KB | Output is correct |
44 | Correct | 3 ms | 744 KB | Output is correct |
45 | Correct | 3 ms | 744 KB | Output is correct |
46 | Correct | 3 ms | 744 KB | Output is correct |
47 | Correct | 3 ms | 744 KB | Output is correct |
48 | Correct | 4 ms | 744 KB | Output is correct |
49 | Correct | 5 ms | 744 KB | Output is correct |
50 | Correct | 4 ms | 744 KB | Output is correct |
51 | Correct | 3 ms | 744 KB | Output is correct |
52 | Correct | 188 ms | 8636 KB | Output is correct |
53 | Correct | 189 ms | 8636 KB | Output is correct |
54 | Correct | 212 ms | 8636 KB | Output is correct |
55 | Correct | 215 ms | 8636 KB | Output is correct |
56 | Correct | 189 ms | 8636 KB | Output is correct |
57 | Correct | 200 ms | 8636 KB | Output is correct |
58 | Correct | 186 ms | 8636 KB | Output is correct |
59 | Correct | 199 ms | 8636 KB | Output is correct |
60 | Correct | 193 ms | 8636 KB | Output is correct |
61 | Correct | 198 ms | 8636 KB | Output is correct |
62 | Correct | 199 ms | 8636 KB | Output is correct |
63 | Correct | 185 ms | 8636 KB | Output is correct |
64 | Correct | 188 ms | 8636 KB | Output is correct |
65 | Correct | 203 ms | 8636 KB | Output is correct |
66 | Correct | 186 ms | 8636 KB | Output is correct |
67 | Correct | 203 ms | 8636 KB | Output is correct |
68 | Correct | 217 ms | 8636 KB | Output is correct |