# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
987677 | 2024-05-23T10:57:18 Z | Tsagana | Art Exhibition (JOI18_art) | C++14 | Compilation error |
0 ms | 0 KB |
#include<bits/stdc++.h> #define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie(); #define all (x) x.begin(), x.end() #define int long long #define pq priority_queue #define lb lower_bound #define ub upper_bound #define pb push_back #define eb emplace_back #define F first #define S second using namespace std; void solve () { int n; cin >> n; pair<int, int> a[500001]; for (int i = 0; i < n; i++) cin >> a[i].F >> a[i].S; sort(a, a + n); int ans, dp[500001]; dp[0] = a[0].S; for (int i = 1; i < n; i++) { dp[i] = max(a[i].S, dp[i - 1] + a [i - 1].F + a[i].S - a[i].F); ans = max(ans, dp[i]); } cout << ans << '\n'; } signed main() {IOS solve(); return 0;}
Compilation message
art.cpp:4:25: error: stray '#' in program 4 | (x) x.begin(), x.end() #define int long long #define pq | ^ art.cpp:4:47: error: stray '#' in program 4 | (x) x.begin(), x.end() #define int long long #define pq | ^ art.cpp:5:17: error: stray '#' in program 5 | priority_queue #define lb lower_bound #define ub upper_bound #define pb | ^ art.cpp:5:40: error: stray '#' in program 5 | priority_queue #define lb lower_bound #define ub upper_bound #define pb | ^ art.cpp:5:63: error: stray '#' in program 5 | priority_queue #define lb lower_bound #define ub upper_bound #define pb | ^ art.cpp:6:12: error: stray '#' in program 6 | push_back #define eb emplace_back #define F first #define S second | ^ art.cpp:6:36: error: stray '#' in program 6 | push_back #define eb emplace_back #define F first #define S second | ^ art.cpp:6:52: error: stray '#' in program 6 | push_back #define eb emplace_back #define F first #define S second | ^ art.cpp:3:68: error: stray '#' in program 3 | #define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie(); #define all | ^ art.cpp:14:16: note: in expansion of macro 'IOS' 14 | signed main() {IOS solve(); return 0;} | ^~~ art.cpp:4:6: error: expected constructor, destructor, or type conversion before 'x' 4 | (x) x.begin(), x.end() #define int long long #define pq | ^ art.cpp: In function 'void solve()': art.cpp:10:24: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 10 | void solve () { int n; cin >> n; pair<int, int> a[500001]; for (int i = 0; i < | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75, from art.cpp:1: /usr/include/c++/10/iostream:60:18: note: 'std::cin' declared here 60 | extern istream cin; /// Linked to standard input | ^~~ art.cpp:10:34: error: 'pair' was not declared in this scope; did you mean 'std::pair'? 10 | void solve () { int n; cin >> n; pair<int, int> a[500001]; for (int i = 0; i < | ^~~~ | std::pair In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from art.cpp:1: /usr/include/c++/10/bits/stl_pair.h:211:12: note: 'std::pair' declared here 211 | struct pair | ^~~~ art.cpp:10:39: error: expected primary-expression before 'int' 10 | void solve () { int n; cin >> n; pair<int, int> a[500001]; for (int i = 0; i < | ^~~ art.cpp:11:16: error: 'a' was not declared in this scope 11 | n; i++) cin >> a[i].F >> a[i].S; sort(a, a + n); int ans, dp[500001]; dp[0] = | ^ art.cpp:10:60: warning: this 'for' clause does not guard... [-Wmisleading-indentation] 10 | void solve () { int n; cin >> n; pair<int, int> a[500001]; for (int i = 0; i < | ^~~ art.cpp:11:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for' 11 | n; i++) cin >> a[i].F >> a[i].S; sort(a, a + n); int ans, dp[500001]; dp[0] = | ^~~~ art.cpp:11:39: error: 'a' was not declared in this scope 11 | n; i++) cin >> a[i].F >> a[i].S; sort(a, a + n); int ans, dp[500001]; dp[0] = | ^ art.cpp:11:34: error: 'sort' was not declared in this scope; did you mean 'std::sort'? 11 | n; i++) cin >> a[i].F >> a[i].S; sort(a, a + n); int ans, dp[500001]; dp[0] = | ^~~~ | std::sort In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from art.cpp:1: /usr/include/c++/10/bits/stl_algo.h:4880:5: note: 'std::sort' declared here 4880 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last, | ^~~~ art.cpp:12:47: error: 'max' was not declared in this scope; did you mean 'std::max'? 12 | a[0].S; for (int i = 1; i < n; i++) { dp[i] = max(a[i].S, dp[i - 1] + a | ^~~ | std::max In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from art.cpp:1: /usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here 3486 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ art.cpp:13:56: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 13 | [i - 1].F + a[i].S - a[i].F); ans = max(ans, dp[i]); } cout << ans << '\n'; } | ^~~~ | std::cout In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75, from art.cpp:1: /usr/include/c++/10/iostream:61:18: note: 'std::cout' declared here 61 | extern ostream cout; /// Linked to standard output | ^~~~ art.cpp: In function 'int main()': art.cpp:3:13: error: 'ios_base' has not been declared 3 | #define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie(); #define all | ^~~~~~~~ art.cpp:14:16: note: in expansion of macro 'IOS' 14 | signed main() {IOS solve(); return 0;} | ^~~ art.cpp:3:46: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 3 | #define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie(); #define all | ^~~ art.cpp:14:16: note: in expansion of macro 'IOS' 14 | signed main() {IOS solve(); return 0;} | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75, from art.cpp:1: /usr/include/c++/10/iostream:60:18: note: 'std::cin' declared here 60 | extern istream cin; /// Linked to standard input | ^~~ art.cpp:3:56: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 3 | #define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie(); #define all | ^~~~ art.cpp:14:16: note: in expansion of macro 'IOS' 14 | signed main() {IOS solve(); return 0;} | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:75, from art.cpp:1: /usr/include/c++/10/iostream:61:18: note: 'std::cout' declared here 61 | extern ostream cout; /// Linked to standard output | ^~~~ art.cpp:3:69: error: 'define' was not declared in this scope 3 | #define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie(); #define all | ^~~~~~ art.cpp:14:16: note: in expansion of macro 'IOS' 14 | signed main() {IOS solve(); return 0;} | ^~~