Submission #1200098

#TimeUsernameProblemLanguageResultExecution timeMemory
1200098OrifkhonStrange Device (APIO19_strange_device)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "debug.hpp"
#else
#define debug(...) 42;
#endif

#define ll long long
#define pb push_back
#define PI 3.14159265358979323846264338327950288419716939937510
 
#define llmax 1e18
#define ntmax 1e9
#define inf 200007
const int MOD = 1000000007;
#define vi vector<int>
#define vll vector<ll>
#define ff first
#define ss second
#define bound 10000001
 
#define all(a) (a).begin(), (a).end()
#define rep(i, a, b) for(ll i=a; i<b; i++)
bool prime(ll a) { if (a==1) return 0; for (int i=2;i<=round(sqrt(a));++i) if (a%i==0) return 0; return 1; }
vll input(ll n){vll a;rep(i,0,n){ll x;cin >> x;a.pb(x);}return a;}
ll minn(vll a, ll n){ll mn = 1e18;rep(i,0,n){mn = min(mn, a[i]);}return mn;}
ll maxx(vll a, ll n){ll mx = 0;rep(i,0,n){mx = max(mx, a[i]);}return mx;}
ll preff(vll a, ll n){ll sm = 0;rep(i,0,n){sm+=a[i];}return sm;}

void setIO() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
}
#define int ll
int goup(int x, int y, vector<int>&a){
	int sm = 0;
	while(true){
		if(x == y){
			sm += a[x];
			return sm;
		}
		sm += a[x];
		sm += a[y];
		x/=2;
		y/=2;
	}
	return sm;
}

pair<int, int> findMinmxx(vi& arr) {
    int n = arr.size();
    int k = n / 2;
    sort(all(arr));
    int mnn = 0;
    for (int i = 0; i < n; i += 2) {
        mnn += arr[i] ^ arr[i+1];
    }
    int mxx = 0;
    rep(i,0,k){
        mxx += arr[i] ^ arr[n-1-i];
    }

    return {mnn, mxx};
}


void solve(){
	int n, A, B;
	cin >> n >> A >> B;
	map<pair<int,int>, int> mp;
	rep(i,0,n){
		int l, r;
		cin >> l >> r;
		for(int t = l; t <= r; t++){
			int x = ((t + (t / B)) % A);
			int y = (t % B);
			mp[{x, y}]++;
			cout << x << ' ' << y << '\n';
			if(mp[{x, y}] > 1){
				cout << mp.size();
				return;
			}
		}
	}
	cout << mp.size();
}

signed main(){	
	setIO();					
	int t;
	t = 1;
	//cin >> t;
	while(t--){
		solve();
		cout << '\n';
	}
	
}
#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...