QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501261#5154. ETAzmrzmrWA 0ms3560kbC++201.1kb2024-08-02 16:09:072024-08-02 16:09:07

Judging History

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

  • [2024-08-02 16:09:07]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3560kb
  • [2024-08-02 16:09:07]
  • 提交

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;
	if(sum - point < 0 )
	{
		cout<<"impossible"<<endl;
		return 0;
	}
	while(1)
	{
		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)
	{
		j++;
		sum = 2*a;
		point = 2*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<<j*b<<" "<<sum_ed<<endl;
	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;
			}
			break;
		}
	}
	cout<<cnt+1<<" "<<b*j;
}

詳細信息

Test #1:

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

input:

1/2

output:

2 1
1 2
2 2

result:

wrong output format Extra information in the output file