답안 #232368

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
232368 2020-05-16T20:49:01 Z jam_xd_ 쌀 창고 (IOI11_ricehub) C++17
컴파일 오류
0 ms 0 KB
#include "ricehub.h"
#include <bits/stdc++.h>
int besthub(int R, int L, int X[], long long B)
{
int rhub = 1,RP;//thub=0;

int operaciones = 0, c_hub=0;

vector<int>dinamic_multiset;

for(int i=0;i<X.size();i++){
	if(rhub <= X[i]){
		for(int j=X[i];j>=rhub;j++){
			operaciones++;

			if(operaciones >= B){
				dinamic_multiset.push_back(c_hub);
				operaciones=0;
				c_hub=0;
				break;
			}
		}
		c_hub++;

	
	}

	if(rhub >= X[i]){
		for(int j=X[i];j<=rhub;j++){
			operaciones++;

			if(operaciones>=B){
				dinamic_multiset.push_back(c_hub);
				operaciones = 0;
				c_hub=0;
				break;
    		}
		}
		c_hub++;
	
	}
}
sort(dinamic_multiset.begin(), dinamic_multiset.end());


cout<<dinamic_multiset[dinamic_multiset.size()-1];

/*bool meh;
for(it = dinamic_multiset.begin(),meh!=true;it++)
	if(it == dinamic_multiset.end()){
		RP = (*it);
		break;
	}
}*/
/////////////////////////////////////////////////////////////////////

	/*for(int i=1;i<=L;i++){

	}*/





  return RP;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:9:1: error: 'vector' was not declared in this scope
 vector<int>dinamic_multiset;
 ^~~~~~
ricehub.cpp:9:1: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/functional:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from ricehub.cpp:2:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
ricehub.cpp:9:8: error: expected primary-expression before 'int'
 vector<int>dinamic_multiset;
        ^~~
ricehub.cpp:11:17: error: request for member 'size' in 'X', which is of non-class type 'int*'
 for(int i=0;i<X.size();i++){
                 ^~~~
ricehub.cpp:17:5: error: 'dinamic_multiset' was not declared in this scope
     dinamic_multiset.push_back(c_hub);
     ^~~~~~~~~~~~~~~~
ricehub.cpp:33:5: error: 'dinamic_multiset' was not declared in this scope
     dinamic_multiset.push_back(c_hub);
     ^~~~~~~~~~~~~~~~
ricehub.cpp:43:6: error: 'dinamic_multiset' was not declared in this scope
 sort(dinamic_multiset.begin(), dinamic_multiset.end());
      ^~~~~~~~~~~~~~~~
ricehub.cpp:43:1: error: 'sort' was not declared in this scope
 sort(dinamic_multiset.begin(), dinamic_multiset.end());
 ^~~~
ricehub.cpp:43:1: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from ricehub.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:4856:5: note:   'std::sort'
     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
     ^~~~
ricehub.cpp:46:1: error: 'cout' was not declared in this scope
 cout<<dinamic_multiset[dinamic_multiset.size()-1];
 ^~~~
ricehub.cpp:46:1: note: suggested alternative:
In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:75:0,
                 from ricehub.cpp:2:
/usr/include/c++/7/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^~~~