QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#728689#9381. 502 Bad Gatewaylylmeichichi#WA 98ms3816kbC++141.0kb2024-11-09 15:40:112024-11-09 15:40:19

Judging History

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

  • [2024-11-09 15:40:19]
  • 评测
  • 测评结果:WA
  • 用时:98ms
  • 内存:3816kb
  • [2024-11-09 15:40:11]
  • 提交

answer

//From: ifffer_2137
#include <bits/stdc++.h>
using namespace std;
#define int __int128
#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;
long double calc(int x){return 1.0*(x*x-(T+2)*x+T*T+T*3)/(T*2);}
pii getans(int x,int y){return mkpr(x/__gcd(x,y),y/__gcd(x,y));}
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 a=T/2+1;pii ans;
		if(calc(a)<calc(a+1)) ans=getans(a*a-(T+2)*a+T*T+T*3,T*2);
		else ans=getans((a+1)*(a+1)-(T+2)*(a+1)+T*T+T*3,T*2);
		cout<<(long long)ans.fir<<' '<<(long long)ans.sec<<'\n';
	}
	return 0;
}

详细

Test #1:

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

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 98ms
memory: 3816kb

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
375000001 1
1 1
1 1
375000001 1
1 1
375000001 1
1 1
1 1
1 1
375000001 1
1 1
1 1
375000001 1
1 1
375000001 1
375000001 1
1 1
375000001 1
1 1
1 1
375000001 1
1 1
375000001 1
375000001 1
1 1
375000001 1
375000001 1
375000001 1
375000001 1
375000001 1
375000001 1
1 1
1 1
375000001 1
1 1
375000001 1
...

result:

wrong answer 2nd lines differ - expected: '1999961560 44721', found: '375000001 1'