Submission #708295

# Submission time Handle Problem Language Result Execution time Memory
708295 2023-03-11T14:00:48 Z 600Mihnea Mars (APIO22_mars) C++17
Compilation error
0 ms 0 KB
#include <cmath>
#include <functional>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <cassert>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>
#include <numeric>
#include <cstdint>
#include <limits>
#include <numeric>
#include <iostream>


using namespace std;

#define int long long

pair<int, int> get(int t, int a, int b)
{
	int x = (t + t / b) % a;
	int y = t % b;
	return { x, y };
}

bool same_dumb(int t1, int t2, int a, int b)
{
	return get(t1, a, b) == get(t2, a, b);
}

int gcd(int a, int b)
{
	if (b == 0) return a;
	return gcd(b, a % b);
}

const int lim = 20;

void print(vector<int> v)
{
	cout << " ---> ";
	for (auto& x : v)
	{
		cout << x << " ";
	}
	cout << "\n";
}

void solve()
{ 
	int n, mod;
	cin >> n;
	{
		int a, b;
		cin >> a >> b;
		a /= gcd(a, b + 1);	
		if (a <= ((int)1e18 + 7) / b)
		{
			a *= b;
			mod = a;
		}
		else
		{
			mod = ((int)1e18 + 7);
		}
	}
	set<int> s;
	vector<pair<int, int>> segs(n);
	for (auto& it : segs)
	{
		cin >> it.first >> it.second;
		int bag = 0;
		for (int j = it.first; j <= it.second; j++)
		{
			bag++;
			s.insert(j % mod);
		}
		assert(mod >= 0);
		if (bag >= mod)
		{
		//	assert((int)s.size() == mod);
		}
	}
	cout << (int)s.size() << "\n";
	exit(0);
}

signed main()
{
#ifdef ONPC	
	FILE* stream;
	freopen_s(&stream, "input.txt", "r", stdin);
#else
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif

	solve();
	return 0;
}

Compilation message

/usr/bin/ld: /tmp/ccYSzFWu.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccePqHjw.o:mars.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccYSzFWu.o: in function `main':
stub.cpp:(.text.startup+0x793): undefined reference to `process(std::vector<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::allocator<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >, int, int, int, int)'
collect2: error: ld returned 1 exit status