Submission #1197156

#TimeUsernameProblemLanguageResultExecution timeMemory
1197156b00legenMagic Show (APIO24_show)C++17
35 / 100
3 ms376 KiB
#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
using ll = long long;

vector<pair<int, int> >Alice() {
	ll x = setN(5000);
	vector<pair<int, int> >res;
	for (int i = 1; i < 5000; i++) {
		if (x % i)
		res.push_back({x % i, i});
		else
		res.push_back({i, 5000});
	}
	return res;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll gcd(ll a, ll b) {
	while (a > 0 && b > 0) {
		if (a > b)
		a %= b;
		else
		b %= a;
	}
	return a + b;
}

ll Bob(vector<pair<int, int> >v) {
	ll res = v[0].second % 5000, m = v[0].first;
	if (v[0].second < 5000)
	swap(res, m);
	for (size_t i = 1; i < v.size(); i++) {
		ll nm = v[i].second % 5000, md = v[i].first;
		if (v[i].second < 5000)
		swap(nm, md);
		for (int j = 0; j < 5000; j++) {
			if (res % md == nm)
			break;
			res += m;
		}
		if (1e18 / md < m / gcd(m, md))
		break;
		else
		m = m * md / gcd(m, md);
	}
	if (res > 1e18)
	while(true)
	return res;
}

Compilation message (stderr)

# 2번째 컴파일 단계

Bob.cpp: In function 'll Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:36:1: warning: control reaches end of non-void function [-Wreturn-type]
   36 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...