| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1354949 | Aviansh | Gingerbread (BOI25_gcd) | C++20 | 111 ms | 4648 KiB |
#include <bits/stdc++.h>
using namespace std;
const int mxa=1e7+5;
vector<int>divs[mxa];
int prim = 0;
void pre(){
for(int i = 1;i<mxa;i++){
divs[i].push_back(i);
if(divs[i].size()==2){
prim++;
}
for(int j = i+i;j<mxa;j+=i){
divs[j].push_back(i);
}
}
}
int n;
bool check(int a, int b, int n){
for(int i = 0;i<=n;i++){
if(gcd(a+i,b+n-i)==1){
return 1;
}
}
return 0;
}
int fin(int arr[]){
int gc=arr[0];
for(int i = 1;i<n;i++){
gc=gcd(gc,arr[i]);
}
return gc;
}
bool add(int arr[], int tim){
if(tim==0){
if(fin(arr)==1){
return 1;
}
else{
return 0;
}
}
bool ans = 0;
for(int i = 0;i<n;i++){
arr[i]++;
ans|=add(arr,tim-1);
arr[i]--;
if(ans)
break;
}
return ans;
}
const int mxans = 100;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
int arr[n];
for(int i = 0;i<n;i++){
cin >> arr[i];
}
for(int i = 0;i<mxans;i++){
if(add(arr,i)){
cout << i;
return 0;
}
}
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... | ||||
