/******************************************************* * Copyright (C) 2015 Haotian Wu * * This file is the solution to the question: * https://www.hackerrank.com/challenges/angry-children * * Redistribution and use in source and binary forms are permitted. *******************************************************/ #include #include #include #include #include using namespace std; int main() { // First sort the array, then we should always pick consecutive numbers in the array. int n,k; scanf("%d %d",&n,&k); int arr[100000]; for (int i=0; i