QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501395#5154. ETAzmrzmrWA 0ms3632kbC++201.4kb2024-08-02 17:43:352024-08-02 17:43:35

Judging History

你现在查看的是最新测评结果

  • [2024-08-02 17:43:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3632kb
  • [2024-08-02 17:43:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 1e6+10;
int dep[N];
int main()
{
	int a,b;
	char c;
	cin>>a>>c>>b;
	int sum = a;
	int point = b-1;
	int j = 1;
	int cnt_ci = 0 ;
	if(sum - point < 0 )
	{
		cout<<"impossible"<<endl;
		return 0;
	}
	while(1)
	{
	//	if(cnt_ci > 5)
//		{
	//		cout<<"impossible"<<endl;
	//		return 0;
	//	}
		for(int i = 1 ; i <= point ; i ++ )
	{
		if( sum - (point * i) < 0 )
		{
			dep[i] = point ;
			int tem = point*i - sum ;
			sum = sum - (point * i);
			dep[i]-=tem;
			dep[i-1]+=tem;
			break;
		}
		else
		{
			sum-=i;
			point -= 1 ;
			dep[i] = 1 ;
			continue;
		}
	}
	if(sum>0)
	{
		cnt_ci++;
//		j+=199;
		sum = 200*a;
		point = 200*b - 1 ;
		memset(dep,0,sizeof(dep));
	}
	else break;
	}
	int sum_ed = 0 ;
	int cnt_dep = 0;
	for(int i = 1; dep[i] ; i++ )
	{
		sum_ed+=dep[i];
		cnt_dep++;
	}	
	int cnt = 0;
//	for(int i = 1 ; dep[i] ; i++ )
//		cout<<dep[i]<<" ";
	cout<<point+1<<" "<<sum_ed<<endl;
	int temcnt;
	for(int i = 1; i <= cnt_dep ; i++)
	{
		if(dep[i] == 1)
		{
			cnt++;
			cout<<cnt<<" "<<cnt+1<<endl;
		}
		else
		{
			cnt++;
			for(int j = 1 ; j <= dep[i] ; j++)
			{
				cout<<cnt<<" "<<cnt+j<<endl;
				temcnt = cnt + j ;
			}
			break;
		}
	}
	int tt=temcnt-1;
	for(int i = 1 ; i <= dep[cnt+1] ; i++ )
	{
		cout<<cnt+1<<" "<<cnt+tt<<endl;
		tt++;
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3632kb

input:

1/2

output:

1 1
1 2

result:

wrong answer Integer parameter [name=y] equals to 2, violates the range [1, 1]