Submission #488653

# Submission time Handle Problem Language Result Execution time Memory
488653 2021-11-19T21:42:31 Z fun_day Rice Hub (IOI11_ricehub) C++14
68 / 100
1000 ms 520 KB
#include <bits/stdc++.h>

using namespace std;

int besthub(int R, int L, int X[], long long B){
  int best = 0;
  for(int i = 0 ; i < R ; i++){
    vector<int> sz;
    int ans = 0;
    for(int j = i + 1 ; j < R ; j++){
      if(X[j] - X[i] > B) break;
      sz.emplace_back(X[j] - X[i]);
    }
    for(int j = i - 1 ; j >= 0 ; j--){
      if(X[i] - X[j] > B) break;
      sz.emplace_back(X[i] - X[j]);
    }
    sort(sz.begin(),sz.end());
    long long len = 0;
    for(int j = 0 ; j < (int)sz.size() ; j++){
      len += sz[j];
      if(len <= B) ans++;
      else break;
    }
    best = max(best , ans);
  }
  return best + 1;
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 304 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 0 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 1 ms 208 KB Output is correct
21 Correct 4 ms 208 KB Output is correct
22 Correct 3 ms 208 KB Output is correct
23 Correct 6 ms 208 KB Output is correct
24 Correct 6 ms 208 KB Output is correct
25 Correct 6 ms 208 KB Output is correct
26 Correct 6 ms 308 KB Output is correct
27 Correct 5 ms 208 KB Output is correct
28 Correct 5 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 19 ms 324 KB Output is correct
4 Correct 19 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 15 ms 208 KB Output is correct
8 Correct 15 ms 324 KB Output is correct
9 Correct 6 ms 208 KB Output is correct
10 Correct 8 ms 308 KB Output is correct
11 Correct 18 ms 324 KB Output is correct
12 Correct 15 ms 208 KB Output is correct
13 Correct 25 ms 324 KB Output is correct
14 Correct 25 ms 208 KB Output is correct
15 Correct 6 ms 208 KB Output is correct
16 Correct 8 ms 308 KB Output is correct
17 Correct 15 ms 324 KB Output is correct
18 Correct 15 ms 208 KB Output is correct
19 Correct 23 ms 208 KB Output is correct
20 Correct 24 ms 208 KB Output is correct
21 Correct 394 ms 392 KB Output is correct
22 Correct 382 ms 456 KB Output is correct
23 Correct 766 ms 392 KB Output is correct
24 Correct 771 ms 400 KB Output is correct
25 Correct 753 ms 408 KB Output is correct
26 Correct 743 ms 400 KB Output is correct
27 Correct 639 ms 404 KB Output is correct
28 Correct 603 ms 400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 520 KB Time limit exceeded
2 Halted 0 ms 0 KB -