답안 #705429

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
705429 2023-03-04T11:01:24 Z penguin133 쌀 창고 (IOI11_ricehub) C++17
68 / 100
1000 ms 1712 KB
#include <bits/stdc++.h>
#include "ricehub.h"
using namespace std;

//#define int long long
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int besthub(int R, int L, int X[], long long B)
{
  int ans = 0;
  for(int i = 0; i < R; i++){
	  int l = i - 1, r = i + 1, cnt = 1, cst = 0;
	  while(l >= 0 || r < R){
		  if(l < 0 || (r != R && X[i] - X[l] > X[r] - X[i])){
			  if(X[r] - X[i] + cst > B)break;
			  cst += X[r] - X[i];
			  r++;
		  }
		  else{
			  if(X[i] - X[l] + cst > B)break;
			  cst += X[i] - X[l];
			  l--;
		  }
		  cnt++;
	  }
	  ans = max(ans, cnt);
  }
  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 308 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 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 308 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 308 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 216 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 308 KB Output is correct
20 Correct 0 ms 312 KB Output is correct
21 Correct 1 ms 312 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 312 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 304 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 3 ms 308 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 312 KB Output is correct
17 Correct 3 ms 212 KB Output is correct
18 Correct 3 ms 212 KB Output is correct
19 Correct 5 ms 212 KB Output is correct
20 Correct 4 ms 212 KB Output is correct
21 Correct 3 ms 320 KB Output is correct
22 Correct 3 ms 340 KB Output is correct
23 Correct 47 ms 340 KB Output is correct
24 Correct 46 ms 340 KB Output is correct
25 Correct 87 ms 356 KB Output is correct
26 Correct 85 ms 428 KB Output is correct
27 Correct 25 ms 340 KB Output is correct
28 Correct 24 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 468 KB Output is correct
2 Correct 5 ms 500 KB Output is correct
3 Execution timed out 1080 ms 1712 KB Time limit exceeded
4 Halted 0 ms 0 KB -