CSES - Datatähti 2025 alku - Results
Submission details
Task:Tikut
Sender:OorigamiK
Submission time:2024-10-28 20:42:52 +0200
Language:C++ (C++20)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:26:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   26 |         std::cout << endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/11/iostream:39,
                 from input/code.cpp:1:
/usr/include/c++/11/ostream:684:5: note: 'std::endl' declared here
  684 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~

Code

#include <iostream>
//#include <algorithm>
//#include <vector>
//#include <math.h>

//using namespace std;

int main() {
	//std::vector<int> numbers;
	int n, m;
	int number;
	std::cin >> n >> m;
	for (int i = 0; i < n; i++) {
		std::cin >> number;
		//numbers.push_back(number);

	}
	for (int i = 0; i < m; i++) {
		if (i < m - 1) {
			std::cout << 1 << " ";
}
		else {
			std::cout << 1;
		}
	}
	std::cout << endl;
	/*sort(numbers.begin(), numbers.end());

	for (int i = 0; i < m; i++) {
		int sum = numbers[n-1];
		int k = n - 2;
		if (!(float(sum) / (i + 2) <= numbers[k] && k >= 0)) {
			//cout << sum << " " << k+1 << " " << i << endl;
		}
		while (float(sum) / (i+(n-k)) <= numbers[k] && k>=0) {
			//cout << sum << " " << k<<" "<<i << endl;
			sum += numbers[k];
			k--;
		}
		//float mean = float(sum) / (i + (n - k));
		//cout << "div " << i + (n - k) << endl;
		int numOfSplits = n-1 - k;
		//std::cout << "num of splits " << numOfSplits << endl;
		k++;
		//std::cout << "k " << numbers[k] << endl;
		//std::cout << "mean " << mean << endl;
		std::vector<int> splittingNumbers;
		std::vector<float> splittingSize;
		int sumOfSplittingNums=0;
		for (int j = n - 1; j >= k; j--) {
			//std::cout << "j " << j << endl;
			int splitNum = (numOfSplits) * float(numbers[j]) / sum;
			//cout << "splitNm " << splitNum<<" "<< float(numbers[j]) / (splitNum+1) << endl;
			sumOfSplittingNums += splitNum;
			splittingNumbers.push_back(splitNum);
			if (splitNum != 0) {
				splittingSize.push_back(float(numbers[j]) / (splitNum+1));
			}
		}
		int dif = numOfSplits - sumOfSplittingNums;
		//std::cout << "dif " << dif << endl;
		while (dif > 0) {
			int max=0;
			int index=0;
			for (int t = 0; t < int(splittingSize.size()); t++) {
				if (max < splittingSize[t]) {
					max = splittingSize[t];
					index = t;
				}
			}
			//std::cout << "index " << index<<" "<<splittingNumbers[index] << " " << n - 1 - index << endl;
			splittingNumbers[index]+=1;
			splittingSize[index] = float(numbers[n-1-index]) / (1+splittingNumbers[index]);
			//std::cout << "splits left "<<dif<<" " << splittingSize[index] << endl;
			dif--;
		}
		int max = 0;
		int min = 999999;
		for (int t = 0; t < int(splittingSize.size()); t++) {
			//std::cout << "splitSize "<<t<<" " << splittingSize[t] << endl;
			if (max < ceil(splittingSize[t])) {
				max = ceil(splittingSize[t]);
			}
			if (min > floor(splittingSize[t])) {
				min = floor(splittingSize[t]);
			}
		}
		for (int t = n-1-int(splittingSize.size()); t >= 0; t--) {
			if (max < numbers[t]) {
				max = numbers[t];
			}
			if (min > numbers[t]) {
				min = numbers[t];
			}
			//std::cout << "min check " << numbers[t] << " " << min << endl;

		}
		//std::cout << "abs diff " << max - min<<" "<<max<<" "<<min << endl;
		//cout << endl;
		std::cout << max - min << " ";
	}*/
	return 1;
}