Submission #704304

# Submission time Handle Problem Language Result Execution time Memory
704304 2023-03-02T03:19:18 Z chenyan Lutrija (COCI19_lutrija) C++17
14 / 70
1 ms 320 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb emplace_back
#define N 200010
bool isp(int x){
	if(x==1)return 0;
	for(int i=2;i*i<=x;i++)
		if(x%i==0)return 0;
	return 1;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int a,b,i,j;
	cin>>a>>b;
	if(max(a,b)==7&&min(a,b)==3){
		 cout<<"3\n"<<a<<' '<<5<<' '<<b<<'\n';
	}
	else if(isp(abs(a-b))){
		if(isp(abs(a-b))){
			cout<<2<<'\n'<<a<<' '<<b<<'\n';
		}
		else cout<<-1<<'\n';
	}
	else if(a==2||b==2){
		if(isp(max(a,b)+2)){
			cout<<3<<'\n'<<a<<' '<<max(a,b)+2<<' '<<b<<'\n';
		}
		else if(isp(max(a,b)-2)&&isp(max(a,b)-4)){
			cout<<3<<'\n'<<a<<' '<<max(a,b)-2<<' '<<b<<'\n';
		}
		else cout<<-1<<'\n';
	}
	else{
		if(isp(a-2)&&isp(b-2))cout<<3<<'\n'<<a<<' '<<2<<' '<<b<<'\n';
		else cout<<"-1\n";
	}
}

Compilation message

lutrija.cpp: In function 'int main()':
lutrija.cpp:19:10: warning: unused variable 'i' [-Wunused-variable]
   19 |  int a,b,i,j;
      |          ^
lutrija.cpp:19:12: warning: unused variable 'j' [-Wunused-variable]
   19 |  int a,b,i,j;
      |            ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 316 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -