Submission #516227

#TimeUsernameProblemLanguageResultExecution timeMemory
516227MohamedAliSaidaneBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<ld,ld> pld; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pii> vpi; typedef vector<pll> vpl; #define pb push_back #define popb pop_back #define all(v) (v).begin(),(v).end() #define ff first #define ss second const ll INF= 1e18 ; const ll MOD = 1e9 + 7; int n, k, l; vi A; int delivery(int N, int K, int L, vi positions) { n = N, k = K, l = L; A = positions; ll ans = 0ll; ll maxt = 0ll; for(auto e: positions) { ans += min(e,l-e); } return 2*ans; } /* int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int N, K, L; vi positions; cin >> N >> K >> L; for(int i = 0; i <N; i ++) { int x; cin >> x; positions.pb(x); } cout << delivery(N,K,L,positions); }*/

Compilation message (stderr)

boxes.cpp: In function 'int delivery(int, int, int, vi)':
boxes.cpp:38:13: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   38 |     return 2*ans;
      |            ~^~~~
boxes.cpp:33:8: warning: unused variable 'maxt' [-Wunused-variable]
   33 |     ll maxt = 0ll;
      |        ^~~~
/usr/bin/ld: /tmp/ccSvWl5R.o: in function `main':
grader.c:(.text.startup+0x1ef): undefined reference to `delivery(int, int, int, int*)'
collect2: error: ld returned 1 exit status