Submission #127250

# Submission time Handle Problem Language Result Execution time Memory
127250 2019-07-09T07:25:50 Z ekrem Boxes with souvenirs (IOI15_boxes) C++
0 / 100
4 ms 376 KB
#include "boxes.h"
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define N 1000005
using namespace std;

typedef long long ll;
typedef pair < int , int > ii;

int n, opt, ans, cvp, bas[N], son[N];

long long delivery(int n, int k, int l, int p[]) {
	for(int i = 0; i < n; i++)
		bas[i] = (i >= k) ? bas[i - k] + p[i]*2 : p[i]*2;
	for(int i = n - 1; i >= 0; i--)
		son[i] = (n - i > k) ? son[i + k] + (l - p[i])*2 : (l - p[i])*2;
	// for(int i = 0; i < n; i++)
	// 	cout << "AMK" << i << " " << bas[i] << " " << son[i] << endl;
	cvp = son[0];
	for(int i = 0; i < n; i++)
		for(int j = i + 1; j < n; j++)
			cvp = min(cvp, bas[i] + son[j] + (j - i - 1 + k - 1)/k*l);
    return cvp;
}

Compilation message

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:21:48: warning: declaration of 'n' shadows a global declaration [-Wshadow]
 long long delivery(int n, int k, int l, int p[]) {
                                                ^
boxes.cpp:19:5: note: shadowed declaration is here
 int n, opt, ans, cvp, bas[N], son[N];
     ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -