Submission #50526

#TimeUsernameProblemLanguageResultExecution timeMemory
50526MrPlanyK blocks (IZhO14_blocks)C++17
0 / 100
7 ms764 KiB
//Euzibillahiminasheytaniracim bismillahirahmanirahym #include <bits/stdc++.h> #define ff first #define ss second #define pb push_back #define mp make_pair #define inf 1000000001 #define ll long long #define PII pair<int,int> using namespace std; ll ans; int n,k,a[1000001]; int main() { cin>>n>>k; for(int i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+1+n); for(int i=1;i<=k-1;i++) ans+=a[i]; ans+=a[n]; cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...