Subtask #0 是完全能过的,拿到了 20 分,但 Subtask#2 只对了一个点,其他全 Wrong Answer。有没有人帮忙看看怎么回事,谢谢啦~
#include<iostream>
using namespace std;
const int N=1e6+50;
int a[N],c[N];
int n,p,q;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>p>>q;
if(p==0)
{
for(int i=1;i<=n;i++)
{
a[i]=5201314;
cout<<a[i]<<" ";
}
return 0;
}
for(int i=1;i<=n;i++)
{
c[i]=i*(i-1)/2;
if(c[i]==p)
{
for(int j=1;j<=i;j++)
{
a[j]=1;
cout<<a[j]<<" ";
}
for(int j=i+1;j<=n;j++)
{
a[j]=1e7;
cout<<a[j]<<" ";
}
break;
}
else
{
if(c[i]>p and c[i-1]<p)
{
a[1]=q-1;
cout<<a[1]<<" ";
for(int j=2;j<=c[i]-p+1;j++)
{
a[j]=2;
cout<<a[j]<<" ";
}
for(int j=c[i]-p+1+1;j<=i;j++)
{
a[j]=1;
cout<<a[j]<<" ";
}
for(int j=i+1;j<=n;j++)
{
a[j]=5201314;
cout<<a[j]<<" ";
}
break;
}
}
}
return 0;
}