Submission #755510

#TimeUsernameProblemLanguageResultExecution timeMemory
755510Desh03XOR (IZhO12_xor)C++17
0 / 100
2057 ms1868 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, x, k = -1, id; cin >> n >> x; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; vector<int> pre(n + 1); for (int i = 1; i <= n; i++) pre[i] = pre[i - 1] ^ a[i - 1]; for (int i = 0; i < n; i++) for (int j = i + 1; j <= n; j++) if ((pre[j] ^ pre[i]) >= x && j - i > k) k = j - i, id = i + 1; cout << id << ' ' << k; }

Compilation message (stderr)

xor.cpp: In function 'int main()':
xor.cpp:17:19: warning: 'id' may be used uninitialized in this function [-Wmaybe-uninitialized]
   17 |     cout << id << ' ' << k;
      |                   ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...