Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- int n;
- cin >> n;
- int e19 = 0, o19 = 0, e = 0, o = 0;
- for(int i = 0; i < n; ++i){
- int x;
- cin >> x;
- if(x % 19 == 0){
- if(x % 2 == 0){
- if(x >= e19){
- e = max(e19, e);
- e19 = x;
- }
- else{
- e = max(x, e);
- }
- }
- else{
- if(x >= o19){
- o = max(o19, o);
- o19 = x;
- }
- else{
- o = max(x, o);
- }
- }
- }
- else{
- if(x % 2 == 0){
- e = max(e, x);
- }
- else{
- o = max(o, x);
- }
- }
- }
- if(e19 * e == 0 && o19 * o == 0){
- cout << 0 << " " << 0;
- }
- else{
- if((e19 + e > o19 + o && e19 * e > 0) || (o19 * o == 0)){
- cout << e19 << " " << e;
- }
- else{
- cout << o19 << " " << o;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement