#include "ricehub.h"
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define M_PI 3.14159265358979323846
#define FILER 0
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll MOD = pow(10, 9) + 7;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const ull INFUL = 0x3f3f3f3f3f3f3f3f;
const ll INFT = 0x3f3f3f3f;
const ull MAX = 1LL << 24;
const ll MODD = 998244353;
const double EPS = 1e-10;
#define V vector
#define pll pair<ll, ll>
#define pull2 pair<ull,ull>
#define MS multiset
#define M map
#define Q queue
#define PQ priority_queue
#define IOF ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FOR(typ,i,a,b,c) for(typ i = a; i < b; i += c)
#define FORR(typ,i,a,b,c) for(typ i = a; i > b; i -= c)
#define FORA(a,i) for(auto &i : a)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define sorta(a) sort(all(a))
#define sortd(a) sort(all(a), greater<ll>())
#define setp(x) setprecision(x)<<fixed
#define RET return
#define log(a,b) log(b)/log(a)
#define WH(s) while(s)
#define WHI(t) WH(t--)
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define YESNO(s) cout << (s ? "YES" : "NO") << endl;
#define YesNo(s) cout<<(s?"Yes":"No")<<endl;
#define TYP 0
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
ll res = 0;
sort(X, X + R);
FOR(ll, i, 0, R, 1)
{
FOR(ll, j, 0, R, 1)
{
ll mres = 0, mr = 0;
FOR(ll, k, 0, R - j, 1)
if ((mr += abs(X[i] - X[j + k])) <= B)
++mres;
res = max(res, mres);
}
}
RET res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
440 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
440 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
600 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
604 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
72 ms |
424 KB |
Output is correct |
22 |
Correct |
79 ms |
424 KB |
Output is correct |
23 |
Correct |
74 ms |
424 KB |
Output is correct |
24 |
Correct |
72 ms |
596 KB |
Output is correct |
25 |
Correct |
75 ms |
424 KB |
Output is correct |
26 |
Correct |
80 ms |
424 KB |
Output is correct |
27 |
Correct |
71 ms |
424 KB |
Output is correct |
28 |
Correct |
76 ms |
444 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
348 KB |
Output is correct |
2 |
Correct |
4 ms |
444 KB |
Output is correct |
3 |
Correct |
454 ms |
440 KB |
Output is correct |
4 |
Correct |
425 ms |
604 KB |
Output is correct |
5 |
Correct |
89 ms |
420 KB |
Output is correct |
6 |
Correct |
72 ms |
420 KB |
Output is correct |
7 |
Correct |
570 ms |
436 KB |
Output is correct |
8 |
Correct |
561 ms |
344 KB |
Output is correct |
9 |
Correct |
75 ms |
348 KB |
Output is correct |
10 |
Correct |
74 ms |
444 KB |
Output is correct |
11 |
Correct |
288 ms |
440 KB |
Output is correct |
12 |
Correct |
287 ms |
344 KB |
Output is correct |
13 |
Correct |
561 ms |
348 KB |
Output is correct |
14 |
Correct |
561 ms |
596 KB |
Output is correct |
15 |
Correct |
71 ms |
344 KB |
Output is correct |
16 |
Correct |
71 ms |
344 KB |
Output is correct |
17 |
Correct |
291 ms |
600 KB |
Output is correct |
18 |
Correct |
287 ms |
344 KB |
Output is correct |
19 |
Correct |
563 ms |
448 KB |
Output is correct |
20 |
Correct |
561 ms |
344 KB |
Output is correct |
21 |
Execution timed out |
1046 ms |
344 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1031 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |