Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- #define max(a,b) (((a) > (b)) ? (a) : (b))
- #define min(a,b) (((a) < (b)) ? (a) : (b))
- int n, m;
- int arr[500][500];
- int func(int value, int depth, vector<int>& ppp)
- {
- int res;
- for (int i = 0; i < m; i++)
- {
- if (depth < n - 1)
- {
- res = func(value ^ arr[depth][i], depth + 1, ppp);
- }
- else
- {
- res = value ^ arr[depth][i];
- }
- if (res > 0)
- {
- ppp.push_back(i + 1);
- return res;
- }
- }
- return res;
- }
- int main()
- {
- cin >> n >> m;
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- {
- cin >> arr[i][j];
- }
- }
- for (int i = 0; i < m; i++)
- {
- vector<int> ppp;
- int l = func(0, 0, ppp);
- if (l > 0)
- {
- cout << "TAK\n";
- //ppp.pop ();
- for (int i = ppp.size () - 1; i >= 0; i--)
- {
- cout << ppp [i] << ' ';
- }
- return 0;
- }
- }
- cout << "NIE";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement