제출 #1112789

#제출 시각아이디문제언어결과실행 시간메모리
1112789kojac마상시합 토너먼트 (IOI12_tournament)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
#define MAXN ((int)(3e5+2))


int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) {

	int mx = -1, ans = 0;

	for(int i = 0; i <= n-1; i++){
		vector<int> v;

		if(i == 0) v.push_back(r);



		for(int j = 0; j <= n-1; j++){
			v.push_back(K[j]);
			if(v.size() == i) v.push_back(r);
		}

		ll at = 0;

		for(int j = 0; j < C; j++){
			vector<int> aux;

			ll venc = 0;

			for(int x = 0; x < S[j]; x++) aux.push_back(v[x]);

			for(int x = S[j]; x <= E[j]; x++) venc = max(venc, v[x]);

			aux.push_back(venc);

			if(venc == R) at++;

			for(int x = E[j]+1; x < v.size(); x++) aux.push_back(v[x]);
		}

		if(at > mx){
			mx = at;
			ans = i;
		}
	}


	return ans;


}

컴파일 시 표준 에러 (stderr) 메시지

tournament.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
tournament.cpp:14:22: error: 'n' was not declared in this scope
   14 |  for(int i = 0; i <= n-1; i++){
      |                      ^
tournament.cpp:17:26: error: 'r' was not declared in this scope
   17 |   if(i == 0) v.push_back(r);
      |                          ^
tournament.cpp:23:16: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |    if(v.size() == i) v.push_back(r);
      |       ~~~~~~~~~^~~~
tournament.cpp:23:34: error: 'r' was not declared in this scope
   23 |    if(v.size() == i) v.push_back(r);
      |                                  ^
tournament.cpp:35:59: error: no matching function for call to 'max(ll&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   35 |    for(int x = S[j]; x <= E[j]; x++) venc = max(venc, v[x]);
      |                                                           ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from tournament.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
tournament.cpp:35:59: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   35 |    for(int x = S[j]; x <= E[j]; x++) venc = max(venc, v[x]);
      |                                                           ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from tournament.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
tournament.cpp:35:59: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   35 |    for(int x = S[j]; x <= E[j]; x++) venc = max(venc, v[x]);
      |                                                           ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from tournament.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
tournament.cpp:35:59: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   35 |    for(int x = S[j]; x <= E[j]; x++) venc = max(venc, v[x]);
      |                                                           ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from tournament.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
tournament.cpp:35:59: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   35 |    for(int x = S[j]; x <= E[j]; x++) venc = max(venc, v[x]);
      |                                                           ^
tournament.cpp:41:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |    for(int x = E[j]+1; x < v.size(); x++) aux.push_back(v[x]);
      |                        ~~^~~~~~~~~~