QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#503044#5154. ETAFoedere0WA 1ms3628kbC++23812b2024-08-03 16:01:302024-08-03 16:01:31

Judging History

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

  • [2024-08-03 16:01:31]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3628kb
  • [2024-08-03 16:01:30]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
//#define endl '\n'
using namespace std;
typedef pair<int,int> PII;
int a,b;
char s;
int cnt=0;
vector<PII> ans;
int get(int x){
	return (x-1)*x/2;
}
void solve(){
	cin>>a>>s>>b;
	if(a<b-1){
		cout<<"impossible"<<endl;
		return;
	}
	while(get(b)<a){
		b+=b;
		a+=a;
	}
	//cout<<a<<" "<<b<<endl;
	int t=a;
	int now=1;
	int op=1;
	int sum=0;
	while(1){
		if(sum+op>t) break;
		ans.push_back({now,now+1});
		now++;
		sum+=op;
		op++;
	}
	t-=sum;
	while(t--){
		now++;
		ans.push_back({1ll,now});
	}
	cout<<b<<" "<<ans.size()<<endl;
	for(auto i:ans){
		cout<<i.first<<" "<<i.second<<endl;
	}
}
signed main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3628kb

input:

1/2

output:

2 1
1 2

result:

ok 

Test #2:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

1/3

output:

impossible

result:

ok 

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3624kb

input:

7/4

output:

8 8
1 2
2 3
3 4
4 5
1 6
1 7
1 8
1 9

result:

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