제출 #1122399

#제출 시각아이디문제언어결과실행 시간메모리
1122399heey선물상자 (IOI15_boxes)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #define int long long #define f first #define s second #define all(x) (x).begin(), (x).end() #define mod 1'000'000'007 #define inf 1'000'000'000'000'00 #define pb push_back #define vvi vector<vi> #define fst cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false); using namespace std; int delivery(int n, int k, int l, int a[]){ int res = 0; int d = 0; int i = 0; int j = n-1; while(i <= j){ //start at zero //cout << i << ' ' << j << ' ' << res << '\n'; int c = k; int prev = 0; //march left while(i <= j && i < n && c > 0){ res += 2*(a[i] - prev); d++; c--; prev = a[i]; i++; if(i != n && a[i] - prev > l - a[i]) break; } //right c = k; prev = l; while(i <= j && j >= 0 && c > 0){ res += 2*(prev - a[j]); d++; c--; prev = a[j]; j--; if(j > 0 && prev - a[j] > a[j]) break; } } return res; }

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

/usr/bin/ld: /tmp/ccILk5hC.o: in function `main':
grader.c:(.text.startup+0x1ef): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status