Submission #723793

# Submission time Handle Problem Language Result Execution time Memory
723793 2023-04-14T10:10:51 Z rshohruh Hacker (BOI15_hac) C++14
40 / 100
90 ms 2456 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int inf = 1e9;
int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  #ifdef __local__
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif
  int n;
  cin >> n;
  vector<int> lis(n);
  for (int i = 0; i < n; i++)
    cin >> lis[i];

  vector<int> sussies(n, inf);
  int k = (n + 1) / 2;
  lis.insert(lis.end(), lis.begin(), lis.end());

  vector<long long> sm(lis.size()+1);
  for(int i = 1; i <= lis.size(); ++i) sm[i] = sm[i-1] + lis[i-1];
  if(n > 5000){
    cout << sm[k];
    exit(0);
  }
  for (int i = 0; i < n; i++) {
    int cur = sm[i+k] - sm[i];
    // for (int j = 0; j < k; j++) 
    //     cur += lis[i+j];

    for (int j = 0; j < k; j++)
      sussies[(i+j)%n] = min(cur, sussies[(i+j)%n]);
  }

  cout << *max_element(sussies.begin(), sussies.end());
  return 0;
}

Compilation message

hac.cpp: In function 'int main()':
hac.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   for(int i = 1; i <= lis.size(); ++i) sm[i] = sm[i-1] + lis[i-1];
      |                  ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 0 ms 212 KB Output is correct
6 Correct 0 ms 212 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 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 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 324 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 0 ms 212 KB Output is correct
6 Correct 0 ms 212 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 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 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 324 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 4 ms 340 KB Output is correct
21 Correct 3 ms 340 KB Output is correct
22 Correct 32 ms 340 KB Output is correct
23 Correct 90 ms 468 KB Output is correct
24 Correct 32 ms 340 KB Output is correct
25 Correct 82 ms 468 KB Output is correct
26 Correct 77 ms 468 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 87 ms 468 KB Output is correct
31 Correct 88 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 81 ms 468 KB Output is correct
4 Incorrect 6 ms 2456 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 0 ms 212 KB Output is correct
6 Correct 0 ms 212 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 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 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 324 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 4 ms 340 KB Output is correct
21 Correct 3 ms 340 KB Output is correct
22 Correct 32 ms 340 KB Output is correct
23 Correct 90 ms 468 KB Output is correct
24 Correct 32 ms 340 KB Output is correct
25 Correct 82 ms 468 KB Output is correct
26 Correct 77 ms 468 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 87 ms 468 KB Output is correct
31 Correct 88 ms 468 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 81 ms 468 KB Output is correct
35 Incorrect 6 ms 2456 KB Output isn't correct
36 Halted 0 ms 0 KB -