# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
202953 | MKopchev | Strongbox (POI11_sej) | C++14 | 990 ms | 5752 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int nmax=3e5+42;
int n;
long long total;
long long inp[nmax];
long long output,proper;
vector<long long> to_test;
void trial(long long num)
{
if(proper%num)return;
for(int i=1;i<=n;i++)
if(inp[i]%num==0)return;
printf("%lld\n",total/num);
exit(0);
}
int main()
{
scanf("%lld%i",&total,&n);
for(int i=1;i<=n;i++)scanf("%lld",&inp[i]);
proper=inp[n];
n--;
for(int i=1;i<=n;i++)inp[i]=__gcd(inp[i],__gcd(proper,total));
set<long long> actual={};
for(int i=1;i<=n;i++)actual.insert(inp[i]);
n=0;
for(auto k:actual)
{
n++;
inp[n]=k;
}
output=total;
for(long long i=1;i*i<=total;i++)
if(total%i==0)
{
to_test.push_back(i);
to_test.push_back(total/i);
}
sort(to_test.begin(),to_test.end());
for(auto k:to_test)
trial(k);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |