# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
198100 | ZwariowanyMarcin | Lutrija (COCI19_lutrija) | C++14 | 238 ms | 476 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define ss(x) (int) x.size()
#define pb push_back
#define LL long long
#define ld double
#define cat(x) cerr << #x << " = " << x << endl
#define FOR(i, j, n) for(int i = j; i <= n; ++i)
#define boost cin.tie(0), ios_base::sync_with_stdio(0);
using namespace std;
LL x, y;
int z;
vector <LL> ans;
bool prime(LL n) {
if (n <= 1) return 0;
for (int i = 2; (LL) i * i <= n; ++i)
if (n % i == 0) return 0;
return 1;
}
int main() {
scanf ("%lld %lld", &x, &y);
if (x > y) {
z = 1;
swap(x, y);
}
if ((x & 1) && (y & 1)) {
bool ok = 1;
for (int i = x; i <= y; i += 2) {
ans.pb(i);
if (!prime(i) || ss(ans) > 30) {
ok = 0;
break;
}
}
if (ok) {
printf ("%d\n", ss(ans));
if (z) reverse(ans.begin(), ans.end());
for (auto it : ans)
printf ("%lld ", it);
exit(0);
}
ans.clear();
}
bool ok1 = 0;
bool ok2 = 0;
ans.pb(x);
if (x == 2) ok1 = 1;
if (!ok1) {
if (prime(x - 2)) {
ok1 = 1;
ans.pb(2);
}
if (!ok1) {
if (prime(x + 2)) {
ok1 = 1;
ans.pb(x + 2);
ans.pb(2);
}
}
}
if (prime(y - 2)) {
ok2 = 1;
ans.pb(y);
}
if (!ok2 && prime(y + 2)) {
ok2 = 1;
ans.pb(y + 2);
ans.pb(y);
}
if (ok1 && ok2) {
if (z) reverse(ans.begin(), ans.end());
printf ("%d\n", ss(ans));
for (auto it : ans)
printf ("%lld ", it);
exit(0);
}
printf ("-1\n");
return 0;
}
컴파일 시 표준 에러 (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... |