# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
308321 | luciocf | 새로운 문제 (POI11_sej) | C++14 | 2 ms | 512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e3+10;
bool mark[maxn];
ll a[maxn];
int main(void)
{
ll n;
int k;
scanf("%lld %d", &n, &k);
for (int i = 1; i <= k; i++)
scanf("%lld", &a[i]);
ll ans = a[k];
for (ll i = 1; i*i <= a[k]; i++)
{
if (a[k]%i) continue;
ll d = i;
memset(mark, 0, sizeof mark);
ll at = 0;
bool ok = 1;
while (!mark[at])
{
mark[at] = 1;
for (int j = 1; j < k; j++)
if (a[j] == at)
ok = 0;
at = (at + d)%n;
}
if (ok) ans = min(ans, d);
memset(mark, 0, sizeof mark);
d = a[k]/i;
at = 0;
ok = 1;
while (!mark[at])
{
mark[at] = 1;
for (int j = 1; j < k; j++)
if (a[j] == at)
ok = 0;
at = (at + d)%n;
}
if (ok) ans = min(ans, d);
}
printf("%lld\n", n/ans);
}
컴파일 시 표준 에러 (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... |