# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
386862 | vanic | Gift (IZhO18_nicegift) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;
const int maxn=1e6+5;
ll a[maxn];
ll sum;
pair < ll, int > v[maxn*3];
set < int > cur;
int main(){
int n, k;
scanf("%d%d", &n, &k);
for(int i=0; i<n; ++i){
scanf("%lld", a+i);
sum+=a[i];
}
if(sum%k){
printf("-1\n");
return 0;
}
sum/=k;
for(int i=0; i<n; ++i){
if(a[i]>sum){
printf("-1\n");