Submission #28486

#TimeUsernameProblemLanguageResultExecution timeMemory
28486Fe (#68)Wine Tasting (FXCUP2_wine)C++98
1 / 1
103 ms3460 KiB
#include<stdio.h> #include<algorithm> #define LL long long using namespace std; LL b[300005],minx,maxx; int main(){ LL n,k,i; scanf("%lld %lld",&n,&k); for(i=0;i<n;i++) scanf("%lld",&b[i]); sort(b,b+n); if(k%2==0) k--; for(i=0;i<k/2;i++) minx+=b[i]; k/=2; k++; for(i=n-1;i>=n-k;i--) maxx+=b[i]; printf("%lld\n",maxx-minx); return 0; }

Compilation message (stderr)

wine.cpp: In function 'int main()':
wine.cpp:8:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld",&n,&k);
                             ^
wine.cpp:9:44: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=0;i<n;i++)    scanf("%lld",&b[i]);
                                            ^
#Verdict Execution timeMemoryGrader output
Fetching results...