Submission #372462

# Submission time Handle Problem Language Result Execution time Memory
372462 2021-02-28T09:28:28 Z hivakarami Strange Device (APIO19_strange_device) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef long double ld;
#define f first
#define s second
 
const int N = 1e6 + 100;
const ll mod = 1e9 + 7;
const ll inf = 1e18 + 10;

bool mark[N];

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n;
	ll a, b;
	cin >> n >> a >> b;
	ll k = a / __gcd(a, b+1);
	if(k > g/b)
		k = inf;
	else
		k *= b;
	
	while(n--)
	{
		ll l, r;
		cin >> l >> r;
		
		if(r - l + 1 >= k)
		{
			cout << k << endl;
			return 0;
		}
		
		for(ll i = l; i <= r; i++)
			mark[(i%k)] = 1;
		
	}
	ll ans = 0;
	for(int i = 0; i < k; i++)
		ans += mark[i];
	cout << ans << endl;
	
	
    return 0;
}


 

Compilation message

strange_device.cpp: In function 'int main()':
strange_device.cpp:24:9: error: 'g' was not declared in this scope
   24 |  if(k > g/b)
      |         ^