Submission #289018

#TimeUsernameProblemLanguageResultExecution timeMemory
289018shrek12357Gap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <climits>
#include <cmath>
#include <fstream>
#include <queue>
#include "gap.h"
using namespace std;
 
long long findGap(int t, int n) {
	if (t == 2) {
		return 0;
	}
	long long max = 1e18 + 5;
	long long pre = 0;
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		long long *mn, *mx;
		MinMax(0, max, &mn, &mx);
		if (i == 0) {
			pre = mx;
			max = mx - 1;
		}
		else {
			if (pre - mx > ans) {
				ans = pre - mx;
			}
			pre = mx;
			max = mx - 1;
		}
	}
	return ans;
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:23:18: error: cannot convert 'long long int**' to 'long long int*'
   23 |   MinMax(0, max, &mn, &mx);
      |                  ^~~
      |                  |
      |                  long long int**
In file included from gap.cpp:11:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:25:10: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
   25 |    pre = mx;
      |          ^~
      |          |
      |          long long int*
gap.cpp:26:13: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
   26 |    max = mx - 1;
      |          ~~~^~~
      |             |
      |             long long int*
gap.cpp:29:12: error: invalid operands of types 'long long int' and 'long long int*' to binary 'operator-'
   29 |    if (pre - mx > ans) {
      |        ~~~ ^ ~~
      |        |     |
      |        |     long long int*
      |        long long int
gap.cpp:30:15: error: invalid operands of types 'long long int' and 'long long int*' to binary 'operator-'
   30 |     ans = pre - mx;
      |           ~~~ ^ ~~
      |           |     |
      |           |     long long int*
      |           long long int
gap.cpp:32:10: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
   32 |    pre = mx;
      |          ^~
      |          |
      |          long long int*
gap.cpp:33:13: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
   33 |    max = mx - 1;
      |          ~~~^~~
      |             |
      |             long long int*