Submission #202952

# Submission time Handle Problem Language Result Execution time Memory
202952 2020-02-18T19:13:58 Z MKopchev Strongbox (POI11_sej) C++14
70 / 100
1000 ms 17144 KB
#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],proper);

    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

sej.cpp: In function 'int main()':
sej.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%i",&total,&n);
     ~~~~~^~~~~~~~~~~~~~~~~~~~
sej.cpp:22:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1;i<=n;i++)scanf("%lld",&inp[i]);
                          ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 372 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 6 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 380 KB Output is correct
2 Correct 14 ms 504 KB Output is correct
3 Correct 14 ms 376 KB Output is correct
4 Correct 16 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 376 KB Output is correct
2 Correct 82 ms 632 KB Output is correct
3 Correct 107 ms 376 KB Output is correct
4 Correct 83 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 376 KB Output is correct
2 Correct 87 ms 764 KB Output is correct
3 Correct 107 ms 504 KB Output is correct
4 Correct 66 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 376 KB Output is correct
2 Correct 105 ms 628 KB Output is correct
3 Correct 106 ms 376 KB Output is correct
4 Correct 87 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 87 ms 376 KB Output is correct
2 Correct 106 ms 760 KB Output is correct
3 Correct 107 ms 504 KB Output is correct
4 Correct 106 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 376 KB Output is correct
2 Correct 106 ms 376 KB Output is correct
3 Correct 105 ms 392 KB Output is correct
4 Correct 109 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 149 ms 6008 KB Output is correct
2 Correct 141 ms 1656 KB Output is correct
3 Correct 379 ms 2044 KB Output is correct
4 Execution timed out 1053 ms 10616 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 148 ms 2064 KB Output is correct
2 Correct 199 ms 2420 KB Output is correct
3 Correct 196 ms 2552 KB Output is correct
4 Execution timed out 1050 ms 10748 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 134 ms 2424 KB Output is correct
2 Correct 226 ms 3064 KB Output is correct
3 Correct 438 ms 3192 KB Output is correct
4 Execution timed out 1065 ms 16760 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 185 ms 2424 KB Output is correct
2 Correct 227 ms 2940 KB Output is correct
3 Correct 572 ms 3192 KB Output is correct
4 Execution timed out 1069 ms 17144 KB Time limit exceeded
5 Halted 0 ms 0 KB -