QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#662441 | #5154. ETA | zmrzmr | WA | 3ms | 3720kb | C++14 | 2.0kb | 2024-10-21 00:17:24 | 2024-10-21 00:17:24 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lll _int128
#define ull unsigned long long
#define PB push_back
#define fi first
#define se second
#define _int _int128
#define fr(i,a,b) for(int i = a ; i <= b ; i++)
#define rp(i,a,b) for(int i = a ; i >= b ; i--)
#define frp(i,a,b) for(int i = 1 ; i < b ; i ++ )
#define re read()
#define db double
#define ld long double
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int inf = 0x3f3f3f3f;
const ll N = 2e5+10;
const ll mod = 1e9+7;
inline ll read()
{
ll x=0,f=0;
char ch=getchar();
while (!isdigit(ch))
f|=(ch =='-'),ch = getchar();
while (isdigit(ch))
x=(x<<1)+(x<<3)+(ch^= 48),ch = getchar();
return f?-x:x;
}
inline void write(ll x)
{
if(x < 0)
putchar('-'),x=-x;
if(x > 9)
write(x/10);
putchar(x%10 + 48);
}
inline void W(ll x,char ch)
{
write(x);
putchar(ch);
}
ll aa[N];
void slove()
{
ll a,b;
char c;
cin>>a>>c>>b;
if(a < b)
{
if(a == b - 1)
{
cout<<b<<" "<<a<<endl;
fr(i,2,b)
{
cout<<1<<" "<<i<<endl;
}
return;
}
cout<<"impossible"<<endl;
return;
}
ll k = a/b;
ll s = 0;
fr(i,0,2*k)
{
if(i == k )
{
if(b == 1)
{
aa[i] = 4*k;
s += (4*k)*i;
}
else
{
aa[i] = 2*k*(b-1) + k*b; s += (3*k*b-2)*i;
}
continue;
}
s += i;
aa[i] = 1;
}
ll sum;
if(b == 1)
{
sum = 6*k;
}
else sum = 3*k*b; //总点
ll tt = a*(sum/b);
ll cha = s - a*(sum/b);
cha = abs(cha);
// cout<<cha<<" "<<s<<tt<<endl;
aa[k] -= cha;
aa[k+1]+=cha;
ll cn;
cout<<sum<<" "<<sum-1<<endl;
fr(i,1,2*k)
{
cout<<i<<" "<<i+1<<endl;
cn = i + 2;
}
fr(i,1,aa[k] - 1)
{
cout<<k<<" "<<cn++<<endl;
}
fr(i,1,aa[k+1]-1)
{
cout<<k+1<<" "<<cn++<<endl;
}
}
int main()
{
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
int tcase = 1;
// cin>>tcase;
while(tcase--)
{
slove();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3660kb
input:
1/2
output:
2 1 1 2
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
1/3
output:
impossible
result:
ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
7/4
output:
12 11 1 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12
result:
ok
Test #4:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
974/975
output:
975 974 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:
ok
Test #5:
score: -100
Wrong Answer
time: 3ms
memory: 3648kb
input:
943/346
output:
2076 2075 1 2 2 3 3 4 4 5 2 6 2 7 2 8 2 9 2 10 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 2 20 2 21 2 22 2 23 2 24 2 25 2 26 2 27 2 28 2 29 2 30 2 31 2 32 2 33 2 34 2 35 2 36 2 37 2 38 2 39 2 40 2 41 2 42 2 43 2 44 2 45 2 46 2 47 2 48 2 49 2 50 2 51 2 52 2 53 2 54 2 55 2 56 2 57 2 58 2 59 2 60 2 6...
result:
FAIL Wrong average distance, got 5654/2076, wanted 943/346