답안 #655202

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
655202 2022-11-03T14:26:18 Z Trumling 쌀 창고 (IOI11_ricehub) C++17
42 / 100
1000 ms 1236 KB
#include "ricehub.h"
#include<iostream>
#include<cmath>
using namespace std;

typedef long long ll;
#define pb push_back
#define F first
#define S second
#define enter cout<<'\n';

int besthub(int R, int L, int X[], long long B)
{
  bool arr[L+1]={ };
for(int i=0;i<R;i++)
{
    arr[X[i]]=true;
}
ll ans=1;
ll count=0;
ll plus=R;
while(plus!=1)
{
if(ans!=1)
break;

for(int i=0;i<=R-plus;i++)
{
ll med=(i+i+plus)/2;
ll curr=0;
for(int j=i;j<i+plus;j++)
    curr+=abs(X[med]-X[j]);
if(curr<=B)
{
    ans=plus;
    break;
}
}
plus--;
}
//cout<<'\n'<<ans<<'\n';
return ans;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:20:4: warning: unused variable 'count' [-Wunused-variable]
   20 | ll count=0;
      |    ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 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 212 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 1 ms 212 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 312 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 17 ms 312 KB Output is correct
22 Correct 21 ms 212 KB Output is correct
23 Correct 2 ms 312 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 2 ms 212 KB Output is correct
26 Correct 2 ms 212 KB Output is correct
27 Correct 12 ms 316 KB Output is correct
28 Correct 10 ms 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 1 ms 1236 KB Output is correct
5 Correct 21 ms 300 KB Output is correct
6 Correct 18 ms 312 KB Output is correct
7 Correct 138 ms 300 KB Output is correct
8 Correct 137 ms 316 KB Output is correct
9 Correct 16 ms 312 KB Output is correct
10 Correct 17 ms 308 KB Output is correct
11 Correct 67 ms 212 KB Output is correct
12 Correct 66 ms 300 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 13 ms 300 KB Output is correct
16 Correct 12 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 1160 KB Output is correct
20 Correct 1 ms 1236 KB Output is correct
21 Execution timed out 1088 ms 340 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1079 ms 468 KB Time limit exceeded
2 Halted 0 ms 0 KB -