답안 #898726

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
898726 2024-01-05T04:58:32 Z Faisal_Saqib 쌀 창고 (IOI11_ricehub) C++17
68 / 100
1000 ms 4876 KB
#pragma once
#include <iostream>
#include <set>
#include <vector>
using namespace std;
int besthub(int r, int l, int x[], long long b)
{
	int ans=0;
	vector<long long> vp;
	vp.push_back(-3e15);
	for(int i=0;i<r;i++)
		vp.push_back(x[i]);
	vp.push_back(3e15);
	// answer is one of the point in the array pos
	for(int i=1;i<=r;i++)
	{
		int cnt=1;
		long long tm=0;
		int l=i-1;
		int r=i+1;
		while(min(vp[i]-vp[l],vp[r]-vp[i])<=(b-tm))
		{
			tm+=min(vp[i]-vp[l],vp[r]-vp[i]);
			if((vp[i]-vp[l])==min(vp[i]-vp[l],vp[r]-vp[i]))
			{
				cnt++;
				l--;
			}
			else
			{
				cnt++;
				r++;
			}
		}
		ans=max(ans,cnt);
	}
	return ans;
}

Compilation message

ricehub.cpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 444 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 452 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 452 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 2 ms 348 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
19 Correct 3 ms 348 KB Output is correct
20 Correct 3 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 3 ms 348 KB Output is correct
23 Correct 33 ms 488 KB Output is correct
24 Correct 31 ms 348 KB Output is correct
25 Correct 71 ms 600 KB Output is correct
26 Correct 71 ms 600 KB Output is correct
27 Correct 22 ms 604 KB Output is correct
28 Correct 21 ms 616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 856 KB Output is correct
2 Correct 4 ms 856 KB Output is correct
3 Execution timed out 1076 ms 4876 KB Time limit exceeded
4 Halted 0 ms 0 KB -