제출 #30550

#제출 시각아이디문제언어결과실행 시간메모리
30550Nikefor선물상자 (IOI15_boxes)C++98
0 / 100
2 ms376 KiB
#include "boxes.h" #include <bits/stdc++.h> #include <algorithm> using namespace std; long long delivery(int N, int K, int L, int p[]) { long long sum = 0; if(K==1) { for(int i=0; i<N; i++) { sum+=p[i]; sum+= (p[i]<(N-p[i]))?p[i]:(N-p[i]); } } else if(K==N) { bool flag = true; int big = 0; int small = 0; int mini=1<<17; long long maxi = 0; for (int i = 0; i < N; ++i) { mini = (mini<p[i])?mini:p[i]; maxi = (maxi>p[i])?maxi:p[i]; if(p[i]>(N>>1)) big++; if(p[i]<(N>>1)) big++; } if(!big) sum = maxi<<1; else if(!small) sum = (N-mini)<<1; else sum = L; } return sum; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:17:11: warning: unused variable 'flag' [-Wunused-variable]
      bool flag = true;
           ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...