Submission #485948

# Submission time Handle Problem Language Result Execution time Memory
485948 2021-11-09T19:45:48 Z tato Lutrija (COCI19_lutrija) C++14
0 / 70
1 ms 288 KB
#include <bits/stdc++.h>
#define ll long long
using namespace std;

bool check(ll a)
{
	ll x=sqrt(a);
	
	for(ll k=2; k<=x; k++)
		if(a%k==0)
			return false;
			
			return true;
	
	
	
}

int main()
{
	ll  a,b;
	
	cin>>a>>b;
	
	if(a==2 or b==2)
		{
			cout<<3<<'\n';
			cout<<a<<' '<<a+b<<' '<<b;
			
			return 0;
		}
	
	if(abs(a-b)==2)
		{
			cout<<2<<'\n';
			cout<<a<<' '<<b;
			return 0;
		}
	if(a==b)
	{
		cout<<3<<'\n';
		cout<<a<<' '<<a+2<<' '<<b;
		return 0;
	}
	if(a-b>60)
		{
			cout<<-1;
			return 0;
		}
	vector <ll> v;
	for(ll i=min(a,b); i<=61; i+=2)
		{
			if(check(i))
				{
					cout<<-1;
					return 0;
				}
			else
				v.push_back(i);
		}
	cout<<v.size()<<'\n';
	
	for(int k=1; k<v.size(); k++)
		cout<<v[k]<<' ';
	
	return 0;
}

Compilation message

lutrija.cpp: In function 'bool check(long long int)':
lutrija.cpp:10:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   10 |   if(a%k==0)
      |   ^~
lutrija.cpp:13:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   13 |    return true;
      |    ^~~~~~
lutrija.cpp: In function 'int main()':
lutrija.cpp:63:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |  for(int k=1; k<v.size(); k++)
      |               ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 OK 0 ms 204 KB Checker has crashed
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 OK 0 ms 204 KB Checker has crashed
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 OK 0 ms 204 KB Checker has crashed
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 OK 0 ms 204 KB Checker has crashed
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 288 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -