ამოხსნების სტატუსი

ამ გვერდზე თქვენ იხილავთ გაგზავნილი ამოხსნების სტატუსს.


გაგზავნის თარიღი: 22.12.2018 15:21:57

ამოცანა: გამოკვლევა 

მომხმარებელი: nikolozi

ვერდიქტი: ამოუხსნელი

შეფასება: 0 ქულა







#define f first


using namespace std;

int n , t , j , k , ans1 , ans;
pair <int , int> p[1000000];

int main() {
	cin >> t >> n;
	
	for ( int i = 0; i < n; i++ ) {
		cin >> k;
		p[i].f = abs(k);
		p[i].s = k;
	}
	
	p[n].f = 0;
	p[n].s = 0;
	
	sort(p , p+n+1);
	
	for ( int i = 1; i <= n; i++ ) {
		if ( ans + abs(p[i].s - p[i-1].s) <= t ) {
			ans = ans + abs(p[i].s - p[i-1].s);
			ans1++;
		}
		else
			break;
	}
	
	cout << ans1;
}
PROB_cpp_UID116PID21_32b6ae/main.cpp:7:1: error: 'pair' does not name a type
 pair <int , int> p[1000000];
 ^~~~
PROB_cpp_UID116PID21_32b6ae/main.cpp: In function 'int main()':
PROB_cpp_UID116PID21_32b6ae/main.cpp:10:2: error: 'cin' was not declared in this scope
  cin >> t >> n;
  ^~~
PROB_cpp_UID116PID21_32b6ae/main.cpp:14:3: error: 'p' was not declared in this scope
   p[i].f = abs(k);
   ^
PROB_cpp_UID116PID21_32b6ae/main.cpp:14:17: error: 'abs' was not declared in this scope
   p[i].f = abs(k);
                 ^
PROB_cpp_UID116PID21_32b6ae/main.cpp:18:2: error: 'p' was not declared in this scope
  p[n].f = 0;
  ^
PROB_cpp_UID116PID21_32b6ae/main.cpp:21:16: error: 'sort' was not declared in this scope
  sort(p , p+n+1);
                ^
PROB_cpp_UID116PID21_32b6ae/main.cpp:24:35: error: 'abs' was not declared in this scope
   if ( ans + abs(p[i].s - p[i-1].s) <= t ) {
                                   ^
PROB_cpp_UID116PID21_32b6ae/main.cpp:32:2: error: 'cout' was not declared in this scope
  cout << ans1;
  ^~~~