QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#601829 | #1881. Roads of the Empire | rotcar07 | WA | 0ms | 3680kb | C++20 | 425b | 2024-09-30 14:12:35 | 2024-09-30 14:12:36 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int N=2e5+5;
typedef __int128 I;
int main(){
std::ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t;cin>>t;
while(t--){
ll n,x,y;cin>>n>>x>>y;
int cnt=0;if(x>y) swap(x,y);
while(y!=x){
if(n%y==0){cnt=-1;break;}
cnt++;y-=n%y;
}
cout<<cnt<<'\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3572kb
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: 0ms
memory: 3624kb
input:
1 88 14 2
output:
2
result:
ok 1 number(s): "2"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3680kb
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 -1 0 -1 0 0 1 0 -1 -1 0 -1 -1 0 0 3 2 -1 -1 -1
result:
wrong answer 4th numbers differ - expected: '4', found: '-1'