QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#503044 | #5154. ETA | Foedere0 | WA | 1ms | 3628kb | C++23 | 812b | 2024-08-03 16:01:30 | 2024-08-03 16:01:31 |
Judging History
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]