QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#596452 | #1835. Fancy Formulas | WuMin4 | WA | 0ms | 3636kb | C++20 | 383b | 2024-09-28 15:49:26 | 2024-09-28 15:49:26 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,p,a,b,c,d,ans;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr),cout.tie(nullptr);
cin>>p>>n;
while(n--){
ans=0;
cin>>a>>b>>c>>d;
if((a+b)%p!=(c+d)%p)
puts("-1");
else{
while(a!=c&&b!=d)
a=(a*2)%p,b=(b*2)%p,ans++;
cout<<ans<<endl;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3636kb
input:
5 10 2 1 3 0 2 1 4 4 1 3 4 0 0 2 0 4 3 3 1 2 0 1 0 1 0 3 0 3 0 1 0 1 1 2 4 4 1 0 1 1
output:
2 1 2 0 0 0 1 -1 -1 -1
result:
wrong answer 4th numbers differ - expected: '-1', found: '0'