Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <sstream>
- #include <vector>
- #include <bitset>
- using namespace std;
- int main()
- {
- ifstream in("input.txt");
- ofstream out("output.txt");
- int n, m;
- vector<int> a;
- in >> n;
- for (int i = 0; i < n; i++)
- {
- int t;
- in >> t;
- a.push_back(t);
- }
- in >> m;
- stringstream ss;
- for (int i = 0; i < m; i++)
- {
- int b;
- in >> b;
- int max = b ^ a[0];
- int indMax = a[0];
- for (int j = 1; j < n; j++)
- {
- int t = b ^ a[j];
- if (max < t)
- {
- max = t;
- indMax = a[j];
- }
- }
- ss << indMax << " ";
- }
- out << ss.str();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement