Submission #205146

# Submission time Handle Problem Language Result Execution time Memory
205146 2020-02-28T07:37:18 Z mraron Lutrija (COCI19_lutrija) C++14
0 / 70
165 ms 396 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool ip(ll x) {
	for(ll i=2;i*i<=x;++i) {
		if(x%i==0) return false;
	}
	return true;
}
int main() {
	ll a,b;
	cin>>a>>b;
	bool rev=false;
	if(a>b) {
		swap(a,b);
		rev=true;
	}
	vector<ll> ans={-1};
	if(a==2) {
		if(ip(b-2)) {
			ans={a,b-2,b};
		}else if(ip(b+2)) {
			ans={a,b+2,b};
		}
	}else {
		vector<ll> ans2;
		for(ll i=a;i<=b;i+=2) {
			if(ip(i)) ans2.push_back(i); else break ;
		}
		if(ans2.back()==b) ans=ans2;
	}
	
	if(rev) reverse(ans.begin(), ans.end());
	if(ans.size()>1) cout<<ans.size()<<"\n";
	for(auto i:ans) cout<<i<<" ";
	cout<<"\n";
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 5 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 154 ms 396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 165 ms 396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 164 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -