瞧瞧我发现了什么!
2019 Round A Problem A
Time Complexity (排序+遍历), 为O(nlogn)
#include <bits/stdc++.h>
using namespace std;
int t;
int main(){
cin>>t;
int n,p;
vector<int> cand;
for(int i =1;i<=t;i++){
cin>>n>>p;
cand.clear();
for(int i =0;i<n;i++){
int a;
cin>>a;
cand.push_back(a);
}
sort(cand.begin(),cand.end());
int min_num = INT_MAX;
vector<int> sums(cand.size()+1);
for(int i =1;i<=cand.size();i++){
sums[i] = sums[i-1] + cand[i-1];
if(i>=p) min_num = min(min_num,cand[i-1]* p -(sums[i] - sums[i-p]));
}
printf("Case #%d: %d\n",i,min_num);
}
return 0;
}
刚才是UTC时间,这个是GMT+8北京时间:下午8点-11点.
Round H 2020 Nov 15 2020, 上午11:00
Round G 2020 开始时间:Oct 18 2020, 12:00 结束时间:Oct 18 2020, 15:00 持续:3 hrs
目前还剩14天开赛![开vpn]: https://codingcompetitions.withgoogle.com/kickstart/schedule
G轮还有19天– Oct 16 记得点开题目做!(3小时时限4题)