Submission #251505

# Submission time Handle Problem Language Result Execution time Memory
251505 2020-07-21T15:02:15 Z MrRobot_28 Lutrija (COCI19_lutrija) C++17
0 / 70
81 ms 384 KB
#include<bits/stdc++.h>
 
using namespace std;
#define int long long
signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int a, b;
	cin >> a >> b;
	if(a > b)
	{
		swap(a, b);
	}
	if(a == 2)
	{
		bool fl1 = true;
		bool fl2 = true;
		for(int j = 2; j * j <= (b - 2); j++)
		{
			if((b - 2) % j == 0)
			{
				fl1 = false;
			}
		}
		for(int j = 2; j * j <= b + 2; j++)
		{
			if((b + 2) % j == 0)
			{
				fl2 = false;
			}
		}
		if(fl2)
		{
		cout << 3 << "\n";
		cout << a << " " << a + b << " " << b;
		}
		else if(fl1)
		{
			cout << 2 << "\n";
			cout << a << " " << b;
		}
		else
		{
			cout << -1;
		}
		return 0;
	}
	int t = a + 2;
	while(t <= b)
	{
		for(int j = 2;  j * j <= t; j++)
		{
			if(t % j == 0)
			{
				cout << -1;
				return 0;
			}
		}
		t += 2;
	}
	cout << (b - a) / 2 + 1 << "\n";
	for(int i = a; i <= b; i += 2)
	{
		cout << i << " ";
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 74 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 79 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 81 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -