Submission #30538

#TimeUsernameProblemLanguageResultExecution timeMemory
30538kavunBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
2 ms376 KiB
#include "boxes.h" #include <bits/stdc++.h> #define pb push_back using namespace std; long long n,l,k,ans = 1e9, cw[10000010], ccw[10000010]; long long delivery(int N, int K, int L, int p[]) { n = N; k = K; for(int i = 0; i < k; i++) cw[i] = 2*p[i]; for(int i = k; i < n; i++) cw[i] = cw[i-k] + 2*p[i]; for(int i = n-1; i >= n-k; i--) ccw[i] = 2*(L-p[i]); for(int i = n-k-1; i >= 0; i--) ccw[i] = ccw[i+k] + 2*(L-p[i]); for(int i = 0; i < n; i++) if(p[i+k] > L/2) ans = min(ans,cw[i] + L + 2*ccw[i+k+1]); return ans; }

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:14:15: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
   for(int i = k; i < n; i++)
               ^
boxes.cpp:16:16: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
   for(int i = n-1; i >= n-k; i--)
               ~^~
boxes.cpp:18:18: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
   for(int i = n-k-1; i >= 0; i--)
               ~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...