Submission #870972

# Submission time Handle Problem Language Result Execution time Memory
870972 2023-11-09T15:54:54 Z aaron_dcoder Art Exhibition (JOI18_art) C++17
100 / 100
402 ms 24876 KB
#define NDEBUG

#ifdef NDEBUG
#define dbg(TXTMSG) if constexpr (false) cerr << "lol"
#define dbgv(VARN) ((void)0)
#define dbgfor(COND) if constexpr (false) for (COND)

#else
#define _GLIBCXX_DEBUG 1
#define _GLIBCXX_DEBUG_PEDANTIC 1
#pragma GCC optimize("trapv")
#define dbg(TXTMSG) cerr << "\n" << TXTMSG
#define dbgv(VARN) cerr << "\n" << #VARN << " = "<< VARN << ", line: " << __LINE__ << "\n"
#define dbgfor(COND) for (COND)

#endif

#include <bits/stdc++.h>
using namespace std;
using ll = long long; 
using pll = pair<ll,ll>;
#define e0 first
#define e1 second
constexpr ll INFTY = 2e18;

ll N;

int main() {

	cin >> N;

	vector<pll> SV(N);
	for (ll i = 0; i < N; ++i)
	{
		cin >> SV[i].e0 >> SV[i].e1;
	}

	sort(SV.begin(),SV.end());


	vector<ll> dp(N);
	dp[0] = SV[0].e1;
	for (ll i = 1; i < N; ++i)
	{
		dp[i] = max(SV[i].e1, dp[i-1] - SV[i].e0 + SV[i-1].e0 + SV[i].e1);
	}

	ll outp = 0;
	for (ll i : dp)
	{
		dbg(i);
		outp = max(outp,i);
	}

	cout << outp;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 440 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 440 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 420 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 1 ms 440 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 440 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 420 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 1 ms 440 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 4 ms 600 KB Output is correct
28 Correct 4 ms 604 KB Output is correct
29 Correct 4 ms 452 KB Output is correct
30 Correct 4 ms 604 KB Output is correct
31 Correct 4 ms 604 KB Output is correct
32 Correct 4 ms 604 KB Output is correct
33 Correct 4 ms 852 KB Output is correct
34 Correct 4 ms 604 KB Output is correct
35 Correct 4 ms 604 KB Output is correct
36 Correct 4 ms 604 KB Output is correct
37 Correct 4 ms 604 KB Output is correct
38 Correct 4 ms 636 KB Output is correct
39 Correct 4 ms 604 KB Output is correct
40 Correct 4 ms 452 KB Output is correct
41 Correct 4 ms 604 KB Output is correct
42 Correct 4 ms 632 KB Output is correct
43 Correct 4 ms 676 KB Output is correct
44 Correct 4 ms 604 KB Output is correct
45 Correct 4 ms 648 KB Output is correct
46 Correct 4 ms 604 KB Output is correct
47 Correct 4 ms 860 KB Output is correct
48 Correct 4 ms 604 KB Output is correct
49 Correct 4 ms 604 KB Output is correct
50 Correct 4 ms 624 KB Output is correct
51 Correct 4 ms 804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 440 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 420 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 1 ms 440 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 4 ms 600 KB Output is correct
28 Correct 4 ms 604 KB Output is correct
29 Correct 4 ms 452 KB Output is correct
30 Correct 4 ms 604 KB Output is correct
31 Correct 4 ms 604 KB Output is correct
32 Correct 4 ms 604 KB Output is correct
33 Correct 4 ms 852 KB Output is correct
34 Correct 4 ms 604 KB Output is correct
35 Correct 4 ms 604 KB Output is correct
36 Correct 4 ms 604 KB Output is correct
37 Correct 4 ms 604 KB Output is correct
38 Correct 4 ms 636 KB Output is correct
39 Correct 4 ms 604 KB Output is correct
40 Correct 4 ms 452 KB Output is correct
41 Correct 4 ms 604 KB Output is correct
42 Correct 4 ms 632 KB Output is correct
43 Correct 4 ms 676 KB Output is correct
44 Correct 4 ms 604 KB Output is correct
45 Correct 4 ms 648 KB Output is correct
46 Correct 4 ms 604 KB Output is correct
47 Correct 4 ms 860 KB Output is correct
48 Correct 4 ms 604 KB Output is correct
49 Correct 4 ms 604 KB Output is correct
50 Correct 4 ms 624 KB Output is correct
51 Correct 4 ms 804 KB Output is correct
52 Correct 374 ms 24744 KB Output is correct
53 Correct 382 ms 24748 KB Output is correct
54 Correct 369 ms 24744 KB Output is correct
55 Correct 380 ms 24876 KB Output is correct
56 Correct 369 ms 24616 KB Output is correct
57 Correct 376 ms 24660 KB Output is correct
58 Correct 373 ms 24636 KB Output is correct
59 Correct 371 ms 24732 KB Output is correct
60 Correct 377 ms 24744 KB Output is correct
61 Correct 372 ms 24764 KB Output is correct
62 Correct 369 ms 24760 KB Output is correct
63 Correct 377 ms 24744 KB Output is correct
64 Correct 371 ms 24660 KB Output is correct
65 Correct 402 ms 24620 KB Output is correct
66 Correct 375 ms 24760 KB Output is correct
67 Correct 389 ms 24616 KB Output is correct
68 Correct 385 ms 24752 KB Output is correct