QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#586838#9381. 502 Bad GatewayYuLan#WA 320ms3708kbC++14582b2024-09-24 15:55:552024-09-24 15:55:56

Judging History

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

  • [2024-09-24 15:55:56]
  • 评测
  • 测评结果:WA
  • 用时:320ms
  • 内存:3708kb
  • [2024-09-24 15:55:55]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
typedef long long ll;
ll a[N];
ll w[N],v[N],c[N];
struct node
{
	ll w,c;
	node(ll w1,ll c1)
	{
		w = w1;
		c = c1;
	}
	bool operator < (const node &b) const
	{
		return c*b.w < w*b.c;
	}
};
ll gcd(ll x,ll y)
{
	return y==0?x:gcd(y,x%y);
}
int main()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		ll x,y;
		cin>>x;
		y = x;
		x = (1ll+x)*x/2ll;
		ll temp = gcd(x,y);
		cout<<x/temp<<" "<<y/temp<<endl;
	}
	return 0;
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 320ms
memory: 3708kb

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
1000000001 2
1 1
1 1
1000000001 2
1 1
1000000001 2
1 1
1 1
1 1
1000000001 2
1 1
1 1
1000000001 2
1 1
1000000001 2
1000000001 2
1 1
1000000001 2
1 1
1 1
1000000001 2
1 1
1000000001 2
1000000001 2
1 1
1000000001 2
1000000001 2
1000000001 2
1000000001 2
1000000001 2
1000000001 2
1 1
1 1
1000000001 ...

result:

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