제출 #393404

#제출 시각아이디문제언어결과실행 시간메모리
393404wmrmr선물상자 (IOI15_boxes)C++17
컴파일 에러
0 ms0 KiB
#include <boxes.h> #include <bits/stdc++.h> #define lli long long int using namespace std; const int MAX = 1e7; lli l[MAX], r[MAX]; lli delivery(int n, int k, lli MOD, int p[]) { for(int i=0;i<n;i++) l[i] = (p[i]<<1) + (i-k>=0) ? l[i-k] : 0; for(int i=n-1;i>=0;i--) { int rev = ( MOD-p[i] )%MOD; r[i] = (rev<<1) + (i+k<=n-1) ? r[i+k] : 0; } lli ret = min( r[0] , l[n-1] ); for(int i=0;i<n-1;i++) ret = min( ret , l[i] + r[i+1] ); lli cyc = MOD<<1; if(n == k) ret = min( ret , cyc ); else { ret = min(ret , r[k] + cyc ); ret = min(ret , l[n-k-1] + cyc ); } for(int i=0;i+k+1<n;i++) ret = min( ret , l[i] + r[i+k+1] + 2*MOD ); return ret; }

컴파일 시 표준 에러 (stderr) 메시지

boxes.cpp: In function 'long long int delivery(int, int, long long int, int*)':
boxes.cpp:13:25: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   13 |   int rev = ( MOD-p[i] )%MOD;
      |             ~~~~~~~~~~~~^~~~
/tmp/ccKlV8y6.o: In function `main':
grader.c:(.text.startup+0x1cb): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status