Submission #838672

# Submission time Handle Problem Language Result Execution time Memory
838672 2023-08-27T14:44:23 Z tch1cherin Gap (APIO16_gap) C++17
Compilation error
0 ms 0 KB
		long long Min = -1, Max = 1e18l + 1;
		vector<long long> front, back;
		for (int i = 0; i < (N + 1) / 2; i++) {
			MinMax(Min + 1, Max - 1, &Min, &Max);
			if (Min != Max) {
				front.push_back(Min);
			}
			back.push_back(Max);
		}
		reverse(back.begin(), back.end());
		vector<long long> A;
		for (auto v : front) {
			A.push_back(v);
		}
		for (auto v : back) {
			A.push_back(v);
		}
		long long gap = 0;
		for (int i = 0; i < N - 1; i++) {
			gap = max(gap, A[i + 1] - A[i]);
		}
		return gap;

Compilation message

gap.cpp:2:3: error: 'vector' does not name a type
    2 |   vector<long long> front, back;
      |   ^~~~~~
gap.cpp:3:3: error: expected unqualified-id before 'for'
    3 |   for (int i = 0; i < (N + 1) / 2; i++) {
      |   ^~~
gap.cpp:3:19: error: 'i' does not name a type
    3 |   for (int i = 0; i < (N + 1) / 2; i++) {
      |                   ^
gap.cpp:3:36: error: 'i' does not name a type
    3 |   for (int i = 0; i < (N + 1) / 2; i++) {
      |                                    ^
gap.cpp:10:10: error: expected constructor, destructor, or type conversion before '(' token
   10 |   reverse(back.begin(), back.end());
      |          ^
gap.cpp:11:3: error: 'vector' does not name a type
   11 |   vector<long long> A;
      |   ^~~~~~
gap.cpp:12:3: error: expected unqualified-id before 'for'
   12 |   for (auto v : front) {
      |   ^~~
gap.cpp:15:3: error: expected unqualified-id before 'for'
   15 |   for (auto v : back) {
      |   ^~~
gap.cpp:19:3: error: expected unqualified-id before 'for'
   19 |   for (int i = 0; i < N - 1; i++) {
      |   ^~~
gap.cpp:19:19: error: 'i' does not name a type
   19 |   for (int i = 0; i < N - 1; i++) {
      |                   ^
gap.cpp:19:30: error: 'i' does not name a type
   19 |   for (int i = 0; i < N - 1; i++) {
      |                              ^
gap.cpp:22:3: error: expected unqualified-id before 'return'
   22 |   return gap;
      |   ^~~~~~