c++MLE求助
查看原帖
c++MLE求助
1280343
a111111111111楼主2024/5/20 20:29
#include<bits/stdc++.h>
using namespace std; const int C=1e9+1e5;
int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	int n,m,z1=0,z2; cin>>n; vector<int> a(n); m=n;
	for(int x=0;x<n;x++) a[x]=x+1;
	while(n)
	{
		int ln=0;
		for(int x=0;x<m;x++)
		{
			if(a[x]==C) break;
			if(x%3==0)
			{
				if(a[x]==m) z2=z1+1;
				ln++; a[x]=C;
			}
		}
		n-=ln; z1++; sort(begin(a),end(a));
	}
	cout<<z1<<' '<<z2;
	return 0;
}
2024/5/20 20:29
加载中...