답안 #1015113

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1015113 2024-07-06T06:16:21 Z vjudge1 Gap (APIO16_gap) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "gap.h"

typedef long long ll;

ll findGap(int T, int N){
    if (T == 1){
        vector<ll> vec;
        while (N > 0){
            N -= 2;

            ll mn = 0, mx = 1e18;
            MinMax(mn, mx, mn, mx);

            vec.push_back(mn);
            vec.push_back(mx);
            
            mn++;
            mx--;
        }

        sort(vec.begin(), vec.end());
        
        ll res = 0;
        for (int i = 1; i < N; i ++)
            res = max(res, a[i] - a[i - 1]);
        return res;
    }
    return 0;
}

Compilation message

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:8:9: error: 'vector' was not declared in this scope
    8 |         vector<ll> vec;
      |         ^~~~~~
gap.cpp:8:9: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from gap.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from gap.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
gap.cpp:8:18: error: expected primary-expression before '>' token
    8 |         vector<ll> vec;
      |                  ^
gap.cpp:8:20: error: 'vec' was not declared in this scope
    8 |         vector<ll> vec;
      |                    ^~~
gap.cpp:13:28: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   13 |             MinMax(mn, mx, mn, mx);
      |                            ^~
      |                            |
      |                            ll {aka long long int}
In file included from gap.cpp:2:
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:32: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   13 |             MinMax(mn, mx, mn, mx);
      |                                ^~
      |                                |
      |                                ll {aka long long int}
In file included from gap.cpp:2:
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:22:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   22 |         sort(vec.begin(), vec.end());
      |         ^~~~
      |         std::sort
In file included from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from gap.cpp:1:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
gap.cpp:26:28: error: 'a' was not declared in this scope
   26 |             res = max(res, a[i] - a[i - 1]);
      |                            ^
gap.cpp:26:19: error: 'max' was not declared in this scope; did you mean 'std::max'?
   26 |             res = max(res, a[i] - a[i - 1]);
      |                   ^~~
      |                   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 gap.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)
      |     ^~~