QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#729088 | #9381. 502 Bad Gateway | lylmeichichi# | WA | 128ms | 3692kb | C++14 | 999b | 2024-11-09 16:28:35 | 2024-11-09 16:28:41 |
Judging History
answer
//From: ifffer_2137
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define inf 0x7fffffff
#define eb emplace_back
#define pii pair<int,int>
#define mkpr make_pair
#define fir first
#define sec second
inline int read(){
char ch=getchar();int x=0,w=1;
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9')x=(x<<1)+(x<<3)+ch-48,ch=getchar();return w==1?x:-x;
}
const int maxn=2e5+5;
int _;
int T;
bool chk(int x, int y, int z, int w) {
return x*w<y*z;
}
signed main(){
#ifndef ONLINE_JUDGE
assert(freopen("data.in","r",stdin));
assert(freopen("test.out","w",stdout));
#endif
_=read();
while(_--){
T=read();
if(T==1){
cout<<1<<' '<<1<<'\n';
continue;
}
int B=sqrt(T/2);
int x=B*B-2*B+2*T,y=2*B;
int z=(B+1)*(B+1)-(B+1)+2*T,w=2*(B+1);
if(chk(x,y,z,w)){
int g=__gcd(x,y);
cout<<x/g<<' '<<y/g<<'\n';
}else{
int g=__gcd(z,w);
cout<<z/g<<' '<<w/g<<'\n';
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3692kb
input:
3 1 2 3
output:
1 1 3 2 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 128ms
memory: 3628kb
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 1249995980 22361 1 1 1 1 1249995980 22361 1 1 1249995980 22361 1 1 1 1 1 1 1249995980 22361 1 1 1 1 1249995980 22361 1 1 1249995980 22361 1249995980 22361 1 1 1249995980 22361 1 1 1 1 1249995980 22361 1 1 1249995980 22361 1249995980 22361 1 1 1249995980 22361 1249995980 22361 1249995980 22361 12...
result:
wrong answer 2nd lines differ - expected: '1999961560 44721', found: '1249995980 22361'