Submission #335107

# Submission time Handle Problem Language Result Execution time Memory
335107 2020-12-11T07:17:15 Z nicholask Strange Device (APIO19_strange_device) C++14
0 / 100
1 ms 364 KB
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
using namespace std;
int gcd(int a,int b){
	while (b) b^=a^=b^=a%=b;
	return a;
}
signed main(){
	int n,a,b;
	cin>>n>>a>>b;
	pair <int,int> p[n];
	for (int i=0; i<n; i++) cin>>p[i].x>>p[i].y;
	if (n==1){
		int f=p[0].y-p[0].x+1;
		int s=a/gcd(a,b+1);
		int op=min(f,s);
		cout<<op<<endl;
	} 
	if (1){
		set <pair <int,int> > s;
		for (int i=0; i<n; i++){
			for (int t=p[i].x; t<=p[i].y; t++) s.insert({(t+t/b)%a,t%b});
		}
		cout<<s.size()<<endl;
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -