답안 #411326

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
411326 2021-05-25T04:20:32 Z jeqcho 쌀 창고 (IOI11_ricehub) C++17
68 / 100
1000 ms 704 KB

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define fi first

// subtask 1,2

int besthub(int R, int L, int X[], ll B){
	int mx=0;
    F0R(i,R)
    {
		int x = X[i];
		vi cost;
		F0R(i,R)
		{
			cost.pb(abs(X[i]-x));
		}
		sort(all(cost));
		ll cur=0;
		int cand=0;
		F0R(i,R)
		{
			if(cur+(ll)cost[i]>B)break;
			cur+=(ll)cost[i];
			++cand;
		}
		mx=max(mx,cand);
	}
	return mx;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 4 ms 204 KB Output is correct
22 Correct 4 ms 304 KB Output is correct
23 Correct 7 ms 304 KB Output is correct
24 Correct 7 ms 204 KB Output is correct
25 Correct 7 ms 300 KB Output is correct
26 Correct 7 ms 204 KB Output is correct
27 Correct 9 ms 204 KB Output is correct
28 Correct 6 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 21 ms 312 KB Output is correct
4 Correct 21 ms 204 KB Output is correct
5 Correct 4 ms 204 KB Output is correct
6 Correct 4 ms 204 KB Output is correct
7 Correct 15 ms 316 KB Output is correct
8 Correct 15 ms 320 KB Output is correct
9 Correct 7 ms 304 KB Output is correct
10 Correct 9 ms 304 KB Output is correct
11 Correct 17 ms 316 KB Output is correct
12 Correct 21 ms 320 KB Output is correct
13 Correct 26 ms 204 KB Output is correct
14 Correct 26 ms 204 KB Output is correct
15 Correct 7 ms 204 KB Output is correct
16 Correct 7 ms 304 KB Output is correct
17 Correct 16 ms 324 KB Output is correct
18 Correct 16 ms 320 KB Output is correct
19 Correct 26 ms 204 KB Output is correct
20 Correct 26 ms 204 KB Output is correct
21 Correct 459 ms 384 KB Output is correct
22 Correct 426 ms 376 KB Output is correct
23 Correct 886 ms 400 KB Output is correct
24 Correct 866 ms 384 KB Output is correct
25 Correct 822 ms 400 KB Output is correct
26 Correct 822 ms 424 KB Output is correct
27 Correct 726 ms 452 KB Output is correct
28 Correct 738 ms 396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1097 ms 704 KB Time limit exceeded
2 Halted 0 ms 0 KB -