Submission #652597

#TimeUsernameProblemLanguageResultExecution timeMemory
652597dilaylay_dilaylaylayXOR (IZhO12_xor)C++17
0 / 100
1 ms340 KiB
#include <iostream> #include <bits/stdc++.h> #include <cmath> #include <algorithm> #include <vector> #include <deque> #include <set> #include <stack> #include <string> #include <map> #include <queue> #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") using namespace std; #define int long long #define ll long long #define vi vector<long long> #define pb push_back #define sz(s) (int)s.size() #define all(v) v.begin(), v.end() #define show(a) cerr << #a <<" -> "<< a <<"\n" #define pp pair<int,int> #define FF first #define SS second #define endl "\n" const int N = 1e6 + 2, N3 = 1e3 + 6, inf = 1e9 + 7, LOG = 20; map<char, int> md{{'N', 0}, {'E', 1}, {'S', 2}, {'W', 3}}; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, 1, 0, -1}; string stepDir = "RDLU"; int n, x, a[N], mx, prf[N], j, pos; bool check(int y) { for (int i = 1; i <= n - y + 1; i++) { int z = prf[i + y - 1] ^ prf[i - 1]; if (z >= x) { pos = i; return 1; } } return 0; } main () { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen("triangles.in", "r", stdin); // freopen("triangles.out", "w", stdout); cin >> n >> x; for (int i = 1; i <= n; i++) { cin >> a[i]; prf[i] = prf[i - 1] ^ a[i]; } int l = 1, r = n, ans = -1; while (l <= r) { int mid = (l + r) / 2; if (check(mid)) { ans = mid; l = mid + 1; } else r = mid - 1; } cout << pos << " " << ans; return 0; }

Compilation message (stderr)

xor.cpp:13: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
   13 | #pragma comment(linker, "/stack:200000000")
      | 
xor.cpp:50:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   50 | main () {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...