이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef vector<pll> vpll ;
// int ab (int x ) { return (x>0?x:-x);
ll delivery(int N , int K , int L,int positions[]){
ll l = L;
int cur = 0 ,s=0;
int k = K ;
for(int i = 0 ; i< N ; i++ ){
s += min(abs(positions[i]-cur),L-abs(positions[i]-cur));
// cout << s << endl;
cur = positions[i] ;
k--;
if( k == 0 ){
s += min(cur,L-cur);
k = K ;
cur = 0 ;
}
}
if( k )s += min(cur,L-cur);
return s;
}
// int main(){
// int p[]={1,2,5};
// cout << delivery(3,2,8,p);
// }
컴파일 시 표준 에러 (stderr) 메시지
boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:25:5: warning: unused variable 'l' [-Wunused-variable]
ll l = L;
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |