QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#377013#1881. Roads of the EmpireKevin5307WA 1ms3652kbC++20973b2024-04-04 20:40:182024-04-04 20:40:19

Judging History

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

  • [2024-04-04 20:40:19]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3652kb
  • [2024-04-04 20:40:18]
  • 提交

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin>>t;
	while(t--)
	{
		ll n,u,v;
		cin>>n>>u>>v;
		if(u==v) cout<<"0\n";
		else if(u==n||v==n) cout<<"-1\n";
		else if((min(u,v)+n)%max(u,v)==0) cout<<"1\n";
		else cout<<"2\n";
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3608kb

input:

4
5 1 2
8 2 5
7 7 2
6 2 5

output:

1
1
-1
2

result:

ok 4 number(s): "1 1 -1 2"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

1
88 14 2

output:

2

result:

ok 1 number(s): "2"

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3564kb

input:

20
3 3 3
20 3 5
3 2 2
17 10 14
4 3 3
1 1 1
5 4 3
7 1 1
11 5 10
14 9 5
2 2 2
16 15 7
3 1 3
4 3 3
1 1 1
19 9 1
18 11 2
20 12 2
8 1 5
15 4 14

output:

0
2
0
2
0
0
1
0
2
2
0
2
-1
0
0
2
2
2
2
2

result:

wrong answer 2nd numbers differ - expected: '-1', found: '2'