답안 #805312

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
805312 2023-08-03T15:03:27 Z Halym2007 쌀 창고 (IOI11_ricehub) C++11
17 / 100
1000 ms 1492 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
map <int, int> m;
vector <int> v;
int besthub(int R, int L, int X[], ll B) {
	for (int i = 0; i < R; ++i) {
		m[X[i]] = 1;
	}
	int jog = 0, ans;
	ll op;

	for (int i = 1; i <= L; ++i) {
		op = 0;
		ans = 0;
		for (int j = 1; j <= L; ++j) {
			if (m.find (j) != m.end()) {
				v.push_back ({abs (i - j)});
			}
		}
		sort (v.begin(), v.end());
		for (int i : v) {
			op += i;
			if (op > B) break;
			ans++;
		}
		jog = max (jog, ans);
		v.clear();
	}
	return jog;
}
//int main() {
//	 freopen("kk.txt", "r", stdin);
//	int R, L;
//	ll B;
//	cin >> R >> L >> B;
//	int X[R];
//	for (int i = 0; i < R; ++i) {
//		cin >> X[i];
//	}
//	cout << besthub (R, L, X, B);
//}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 308 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 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 Correct 2 ms 212 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 8 ms 212 KB Output is correct
6 Correct 7 ms 212 KB Output is correct
7 Correct 9 ms 312 KB Output is correct
8 Correct 11 ms 308 KB Output is correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 697 ms 300 KB Output is correct
2 Correct 700 ms 312 KB Output is correct
3 Execution timed out 1088 ms 340 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1080 ms 1492 KB Time limit exceeded
2 Halted 0 ms 0 KB -