답안 #976575

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
976575 2024-05-06T18:14:14 Z Isam Gap (APIO16_gap) C++17
컴파일 오류
0 ms 0 KB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;

long long findGap(int T, int N){
	
	static long long mn, mx;
	long long ans = -((long long)1E18 + 7);
	
	if(T == 1 || N <= 10){
		vector<long long> a(N+1, 0ll);
		
		MinMax(0ll, (long long)1E18, mn, mx);
	
		a[1] = mn, a[N] = mx;
	
		for(register int i = 2; i <= N/2 + (N & 1); ++i){
		
			long long l = a[i-1], r = a[N - (i-1) + 1];
		
			MinMax(l+1, r-1, mn, mx); // called by reference
	
			a[i] = mn, a[N - i + 1] = mx;
		
		}
		
		for(register int i = 2; i <= N; ++i) ans = max(ans, a[i] - a[i-1]);
		
		return ans;
		
	}
 	
 //	MinMax(0ll, (long long)1E18, &mn, &mx);
 	
 	
 	
 	
 	
 	
 	
 	
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:13:32: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   13 |   MinMax(0ll, (long long)1E18, mn, mx);
      |                                ^~
      |                                |
      |                                long long int
In file included from gap.cpp:1:
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:13:36: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   13 |   MinMax(0ll, (long long)1E18, mn, mx);
      |                                    ^~
      |                                    |
      |                                    long long int
In file included from gap.cpp:1:
gap.h:1:47: note:   initializing argument 4 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:17:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 |   for(register int i = 2; i <= N/2 + (N & 1); ++i){
      |                    ^
gap.cpp:21:21: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   21 |    MinMax(l+1, r-1, mn, mx); // called by reference
      |                     ^~
      |                     |
      |                     long long int
In file included from gap.cpp:1:
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:21:25: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   21 |    MinMax(l+1, r-1, mn, mx); // called by reference
      |                         ^~
      |                         |
      |                         long long int
In file included from gap.cpp:1:
gap.h:1:47: note:   initializing argument 4 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:27:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   27 |   for(register int i = 2; i <= N; ++i) ans = max(ans, a[i] - a[i-1]);
      |                    ^
gap.cpp:42:1: warning: control reaches end of non-void function [-Wreturn-type]
   42 | }
      | ^