Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- int n,i,x,mem,a1,a2;
- int maxi = 0;
- vector <int> a(150,0);
- cin >> n;
- for(i = 0;i < n;i++)
- {
- cin >> x;
- mem = a[(110-(x % 110)) % 110];
- if(mem != 0 && mem > x)
- {
- if(x + mem > maxi)
- {
- maxi = mem + x;
- a1 = mem;
- a2 = x;
- }
- }
- if(x > a[x % 110])
- a[x % 110] = x;
- }
- cout << a1 << " " << a2 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement