QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#588847#9381. 502 Bad Gatewaysn933WA 149ms3644kbC++20751b2024-09-25 14:53:122024-09-25 14:53:13

Judging History

你现在查看的是最新测评结果

  • [2024-09-25 14:53:13]
  • 评测
  • 测评结果:WA
  • 用时:149ms
  • 内存:3644kb
  • [2024-09-25 14:53:12]
  • 提交

answer

#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define int long long
#define ull unsigned long long
#define ii __int128
#define endl '\n'
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
const double pi=acos(-1.0);

const int N=1e5+5;

int t;
void solve(){
	cin>>t;
	int l=floor(sqrtl(2*t));
	int r=ceil(sqrtl(2*t));
	int xl=2*t+l*(l-1),yl=2*l;
	int dl=__gcd(xl,yl);
	xl/=dl;yl/=dl;
	int xr=xl=2*t+r*(r-1),yr=2*r;
	int dr=__gcd(xr,yr);
	xr/=dr,yr/=dr;
	if((ii)(xl)*yr<(ii)(xr)*yl){
		cout<<xl<<' '<<yl<<endl;
	}else{
		cout<<xr<<' '<<yr<<endl;
	}
}
signed main(){
	IOS;
	int _=1;
	cin>>_;
	while(_--)
		solve();

	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3524kb

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 149ms
memory: 3644kb

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
2000006281 44722
1 1
1 1
2000006281 44722
1 1
2000006281 44722
1 1
1 1
1 1
2000006281 44722
1 1
1 1
2000006281 44722
1 1
2000006281 44722
2000006281 44722
1 1
2000006281 44722
1 1
1 1
2000006281 44722
1 1
2000006281 44722
2000006281 44722
1 1
2000006281 44722
2000006281 44722
2000006281 44722
20...

result:

wrong answer 2nd lines differ - expected: '1999961560 44721', found: '2000006281 44722'