QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#579892 | #9381. 502 Bad Gateway | xueman | WA | 532ms | 3756kb | C++17 | 694b | 2024-09-21 19:01:54 | 2024-09-21 19:01:55 |
Judging History
answer
#include<bits/stdc++.h>
#define int __int128_t
#define endl '\n'
using namespace std;
void print(int x)
{
if (x == 0)
return;
print(x/10);
cout << (long long)(x % 10);
}
int gcd(int a,int b)
{
while (b ^= a ^= b ^= a %= b)
;
return a;
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n;
cin>>n;
while(n--)
{
long long T;
cin>>T;
int k=(T-1)/2+1;
int c1=T-1-k,c2=T,a=k+1;
int x=(k+1)*(k+2)/2;
int ans1,ans2;
ans1=x*(c2-c1)+a*c1;
ans2=(c2-c1)*(c2-c1);
int m = gcd(ans1,ans2);
ans1/=m;
ans2/=m;
print(ans1);
cout << ' ';
print(ans2);
cout << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3536kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 532ms
memory: 3756kb
input:
1000000 1 1000000000 1 1 1000000000 1 1000000000 1 1 1 1000000000 1 1 1000000000 1 1000000000 1000000000 1 1000000000 1 1 1000000000 1 1000000000 1000000000 1 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1 1 1000000000 1 1000000000 1000000000 1000000000 1000000000 1 1 1 10000000...
output:
1 1 125000001250000000 500000001 1 1 1 1 125000001250000000 500000001 1 1 125000001250000000 500000001 1 1 1 1 1 1 125000001250000000 500000001 1 1 1 1 125000001250000000 500000001 1 1 125000001250000000 500000001 125000001250000000 500000001 1 1 125000001250000000 500000001 1 1 1 1 1250000012500000...
result:
wrong answer 2nd lines differ - expected: '1999961560 44721', found: '125000001250000000 500000001'