Submission #204190

#TimeUsernameProblemLanguageResultExecution timeMemory
204190awlintqaaBoxes with souvenirs (IOI15_boxes)C++14
Compilation error
0 ms0 KiB
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #include <bits/stdc++.h> using namespace std; #define sqr 200 #define mid (l+r)/2 #define pb push_back #define ppb pop_back #define fi first #define se second #define lb lower_bound #define ub upper_bound #define ins insert #define era erase #define C continue #define mem(dp,i) memset(dp,i,sizeof(dp)) #define mset multiset typedef long long ll; typedef short int si; typedef long double ld; typedef pair<int,int> pi; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pi> vpi; typedef vector<pll> vpll; const ll mod=1e9+7; const ll inf= 4e18; const ld pai=acos(-1); #include "boxes.h" ll solve ( ll N , ll K ,ll L ) { ll ans = 0 , last = 0; ll k = K ; for(int i =0 ;i < N ;i ++ ) { ll x1 = abs ( last - P[i] ); ll x2 = L - abs ( last - P[i] ); ans += min ( x1 , x2 ); last = P[i]; k -- ; if ( x2 <= x1 ) k = K ; if ( k == 0){ ans += min ( abs(last-0) , L - abs(last-0) ) ; last = 0 ; k = K ; } } if ( k ) ans += min ( abs(last-0) , L - abs(last-0) ) ; return ans ; } long long delivery(int N, int K, int L, int p[]) { for ( int i = 0 ; i < N ; i ++ )P[i] = p[i]; return solve ( N , K , L ) ; }

Compilation message (stderr)

boxes.cpp: In function 'll solve(ll, ll, ll)':
boxes.cpp:34:38: error: 'P' was not declared in this scope
                 ll x1 = abs ( last - P[i] );
                                      ^
boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:50:41: error: 'P' was not declared in this scope
         for ( int i = 0 ; i < N ; i ++ )P[i] = p[i];
                                         ^