제출 #947608

#제출 시각아이디문제언어결과실행 시간메모리
9476084QT0R선물상자 (IOI15_boxes)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long ll pref[10000002]; ll suf[10000002]; ll delivery(ll n, ll k, ll l, ll positions[]){ for (int i = 0; i<k; i++)pref[i]=positions[i]; for (int i = k; i<n; i++)pref[i]=positions[i]+pref[i-k]; for (int i = n-1; i>n-k-1; i--)suf[i]=l-positions[i]; for (int i = n-k-1; i>=0; i--)suf[i]=l-positions[i]+suf[i+k]; ll ans=suf[0]; for (int i = 0; i<n-1; i++)ans=min(ans,2*pref[i]+2*suf[i+1]); for (int i = 0; i<n-1; i++)ans=min(ans,2*pref[i]+l+2*(i+k<n ? suf[i+k] : suf[n-1])); return ans; }

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

boxes.cpp: In function 'long long int delivery(long long int, long long int, long long int, long long int*)':
boxes.cpp:10:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   10 |  for (int i = k; i<n; i++)pref[i]=positions[i]+pref[i-k];
      |               ^
boxes.cpp:11:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   11 |  for (int i = n-1; i>n-k-1; i--)suf[i]=l-positions[i];
      |               ~^~
boxes.cpp:12:18: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   12 |  for (int i = n-k-1; i>=0; i--)suf[i]=l-positions[i]+suf[i+k];
      |               ~~~^~
/usr/bin/ld: /tmp/ccCOER6C.o: in function `main':
grader.c:(.text.startup+0x1ef): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status