Submission #637242

# Submission time Handle Problem Language Result Execution time Memory
637242 2022-09-01T06:50:56 Z iee Trol (COCI19_trol) C++17
0 / 50
1 ms 304 KB
// iee
#include <bits/stdc++.h>

#define rep(i, a, b) for (auto i = (a); i <= (b); ++i)
#define per(i, a, b) for (auto i = (a); i >= (b); --i)
#define fi first
#define se second
using ll = long long;
using ull = unsigned long long;
using namespace std;
void work(int);

template <class T> void read(T &x) {
  x = 0; int f = 1, ch = getchar();
  while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
  while (isdigit(ch)) x = x * 10 + (ch - '0'), ch = getchar();
  x *= f;
}

int main() {
  int TT = 1; // cin >> TT;
  rep(CAS, 1, TT)
    work(CAS);
  return 0;
}
bool isp(ll x) {
  if (x <= 1) return 0;
  rep(i, 2, x / i) if (x % i == 0) return 0;
  return 1;
}
void work(int CASE) {
  ll a, b; cin >> a >> b;
  if (a != 2 && !isp(a - 2) && !isp(a + 2)) { puts("-1"); return; }
  if (b != 2 && !isp(b - 2) && !isp(b + 2)) { puts("-1"); return; }
  vector<ll> ans;
  if (isp(a - 2)) ans.push_back(a);
  else if (isp(a + 2)) ans.push_back(a), ans.push_back(a + 2);
  ans.push_back(2);
  if (isp(b - 2)) ans.push_back(b);
  else if (isp(b + 2)) ans.push_back(b + 2), ans.push_back(b);
  cout << ans.size() << '\n';
  for (ll x: ans) cout << x << ' ';
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Incorrect 1 ms 304 KB Output isn't correct
5 Incorrect 1 ms 212 KB Output isn't correct