QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#596452#1835. Fancy FormulasWuMin4WA 0ms3636kbC++20383b2024-09-28 15:49:262024-09-28 15:49:26

Judging History

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

  • [2024-09-28 15:49:26]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3636kb
  • [2024-09-28 15:49:26]
  • 提交

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'