| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1359763 | Ludissey | Gingerbread (BOI25_gcd) | C++20 | 120 ms | 8260 KiB |
#include <bits/stdc++.h>
#define int long long
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
signed main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
int n; cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
sort(all(a));
int mn=1e9;
for (int i = 0; i < n-1; i++)
{
int _i=i+1;
for (int k = 0; k <= mn; k++)
{
for (int j = 0; j <= k; j++)
{
if(__gcd(a[i]+j,a[_i]+(k-j))==1) {
mn=min(k,mn); break;
}
}
}
}
cout << mn << "\n";
return 0;
} | # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
