Submission #30549

#TimeUsernameProblemLanguageResultExecution timeMemory
30549NikeforBoxes with souvenirs (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(N==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; }

Compilation message (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...