Submission #1174515

#TimeUsernameProblemLanguageResultExecution timeMemory
1174515tkm_algorithmsStrange Device (APIO19_strange_device)C++20
10 / 100
5095 ms589824 KiB
/**
*    In the name of Allah
*    We are nothing and you're everything
*    author: najmuddin
**/
#include <bits/stdc++.h>
using namespace std;
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
#define int ll
const char nl = '\n';
const int N = 1e7;

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n, a, b;
	cin >> n >> a >> b;
	
	set<pair<int, int>> st;
	for (int i = 0; i < n; ++i) {
		int l, r; cin >> l >> r;
		
		for (int j = l; j <= r; ++j)st.insert({(j+j/b)%a, j%b});
	}
	cout << sz(st);
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...