Submission #331092

# Submission time Handle Problem Language Result Execution time Memory
331092 2020-11-27T10:14:10 Z Pety Boxes with souvenirs (IOI15_boxes) C++14
0 / 100
9 ms 492 KB
#include <bits/stdc++.h>
#include "boxes.h"

using namespace std;

const int N = 10000002;
long long dp[N], dp2[N];

long long delivery (int n, int k, int l, int poz[]) {
  for (int i = n; i >= 1; i--) poz[i] = poz[i - 1]; ///oof
  for (int i = 1; i <= n; i++)
    dp[i] = (i >= k ? dp[i - k] + 2 * poz[i] : 2 * poz[i]);
  for (int i = n; i >= 1; i--)
    dp2[i] = (i <= n - k ? dp2[i + k] + 2 * (l - poz[i]) : 2 * (l - poz[i]));
  long long ans = 0;
  for (int i = 0; i <= n; i++)
    ans =max(ans, dp[i] + dp2[i + 1]);
  for (int i = 0; i <= n - k; i++)
    ans = max(ans, dp[i] + dp2[i + k + 1] + l);
  return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -