답안 #614882

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
614882 2022-07-31T05:21:16 Z Shithila 쌀 창고 (IOI11_ricehub) C++14
17 / 100
1000 ms 340 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
	int dis[R];
	int pos=0;
	long long max=0;
  	for(int k=0;k<R;k++)
  	{
  		int i=X[k];
  		for(int j=0;j<R;j++)
  		{
  			dis[j]=abs(i-X[j]);
		}
		sort(dis,dis+R);
		long long sum=0;
		int j=0;
		while(sum<=B && j<R)
		{
			sum=sum+dis[j];
			j++;
		}
		j--;
		if(pos<j)
		{
			pos=j;
		}
		//cout<<i<<" "<<j<<endl;
  	}	
  	return pos;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:8:12: warning: unused variable 'max' [-Wunused-variable]
    8 |  long long max=0;
      |            ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 16 ms 312 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1085 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -