Submission #330518

# Submission time Handle Problem Language Result Execution time Memory
330518 2020-11-25T15:30:46 Z Cybaen Strange Device (APIO19_strange_device) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define st first
#define nd second
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii; 
typedef vector<vi> vvi;  
#define sz(a) int((a).size()) 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>b;i--)
#define endl "\n"
#define fre freopen("in.txt","r",stdin);freopen("out.txt","w",stdout)
#define start ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define N 100002
const ll INF = 1e18+3;
unordered_map<ll,ll> mp;
ll A,B,c;

void mark1(ll n)
{
	for(ll i=n;i<INF;i+=c)
	{
		mp[i]=1;
	}

}
void mark2()
{
	ll temp=__detail::__lcm(A,B);
	for(ll i=temp;i<100;i+=temp)
	{
		mp2[i]=1;
	}
}

void solve()
{
int n;
ll ans=0;
ll l,r;
cin>>n>>A>>B;
c=A*B;
bool check=false;

for(ll i=0;i<n;i++)
{
	cin>>l>>r;
	rep(j,0,r-l+1)
	{
	if(mp[l+j]==1)
	{
		continue;
	}
	else
	{
		ans++;
		mark1(l+j);
	}
}

}
cout<<ans<<endl;

}

int main(){
	start
	solve();
	
}

Compilation message

strange_device.cpp: In function 'void mark2()':
strange_device.cpp:65:3: error: 'mp2' was not declared in this scope; did you mean 'mp'?
   65 |   mp2[i]=1;
      |   ^~~
      |   mp
strange_device.cpp: In function 'void solve()':
strange_device.cpp:76:6: warning: unused variable 'check' [-Wunused-variable]
   76 | bool check=false;
      |      ^~~~~