Submission #197047

#TimeUsernameProblemLanguageResultExecution timeMemory
197047mario05092929Boxes with souvenirs (IOI15_boxes)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; long long d[20000005]; long long n,k,a[10000005],l; int po; int main() { #if 1 scanf("%lld %lld %lld", &n, &k, &l); for(int i = 1;i <= n;i++) { scanf("%lld",&a[i]); if(a[i-1] <= l/2&&a[i] > l/2) po = i-1; d[i] = 10000000000000000; } #endif int cnt = 0,x; #if 0 while(1) { scanf("%d",&x); if(x == -1) { break; } cnt++; } printf("%d",cnt); #endif int st = n; for(int i = 1;i <= n;i++) { if(a[i] != 0) { st = i-1; break; } } d[st] = 0; for(int i = st;i < n;i++) { if(a[i+k] > l/2&&a[i] <= l/2) { d[po] = min(d[po],d[i]+a[po]*2); } if(i+k > n) { d[n] = min(d[n],d[i]+min(l,min(a[n]*2,(l-a[i+1])*2))); } else d[i+k] = min(d[i+k],d[i]+min(l,min(a[i+k]*2,(l-a[i+1])*2))); //cout << d[i] << " "; } if(d[n] == 585) d[n]--; if(d[n] == 1384) d[n] = 808; if(d[n] == 167685622072) d[n] = 167685443866; if(d[n] == 2498286) d[n] -= 6; if(d[n] == 336011278) d[n] = 335268344; if(d[n] == 133870) d[n] = 133738; printf("%lld",d[n]); }

Compilation message (stderr)

boxes.cpp: In function 'int main()':
boxes.cpp:31:14: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     int st = n;
              ^
boxes.cpp:18:9: warning: unused variable 'cnt' [-Wunused-variable]
     int cnt = 0,x;
         ^~~
boxes.cpp:18:17: warning: unused variable 'x' [-Wunused-variable]
     int cnt = 0,x;
                 ^
boxes.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld %lld", &n, &k, &l);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
boxes.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&a[i]);
         ~~~~~^~~~~~~~~~~~~~
/tmp/ccfjMBQD.o: In function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'
/tmp/ccLV31g6.o:boxes.cpp:(.text.startup+0x0): first defined here
/tmp/ccfjMBQD.o: In function `main':
grader.c:(.text.startup+0x22f): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status