Submission

Status:

[P][-][-][P][-][P][-][P][P-][P]

Subtask/Task Score:

{10/10}{0/10}{0/10}{10/10}{0/10}{10/10}{0/10}{10/10}{0/10}{10/10}

Score: 50

User: VggT

Problemset: กองส้ม

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-17 10:51:57

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int L, n;
	cin >> L >> n;
	
	vector<int> vec;
	
	vec.push_back(1);
	
	for(int i = 2; i <= L; i++)
	{
		vec.push_back(i*i);
	}
	
	int index = 0;
	
	while(n > 0)
	{
		if(vec[index] == 0)
		{
			L-=1;
			index+=1;
		}
		vec[index]-=1;
		n-=1;
	}
	
	if(vec[L-1] == 0) cout << 0;
	else cout << L;
			
	
	return 0;
}