QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501261 | #5154. ETA | zmrzmr | WA | 0ms | 3560kb | C++20 | 1.1kb | 2024-08-02 16:09:07 | 2024-08-02 16:09:07 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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