QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#501387 | #5154. ETA | zmrzmr | WA | 0ms | 7508kb | C++20 | 1.4kb | 2024-08-02 17:40:04 | 2024-08-02 17:40:05 |
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;
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=200;
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<<j*b<<" "<<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++;
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
input:
1/2
output:
2 1 1 2
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
1/3
output:
impossible
result:
ok
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 7508kb
input:
7/4
output:
800 799 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 ...
result:
FAIL Graph not connected, vertex 800 unreachable