Submission #704290

#TimeUsernameProblemLanguageResultExecution timeMemory
704290chenyanLutrija (COCI19_lutrija)C++17
7 / 70
1 ms320 KiB
#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){ 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(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)){ 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 (stderr)

lutrija.cpp: In function 'int main()':
lutrija.cpp:18:10: warning: unused variable 'i' [-Wunused-variable]
   18 |  int a,b,i,j;
      |          ^
lutrija.cpp:18:12: warning: unused variable 'j' [-Wunused-variable]
   18 |  int a,b,i,j;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...