제출 #90060

#제출 시각아이디문제언어결과실행 시간메모리
90060YaroslaffXOR (IZhO12_xor)C++14
0 / 100
2 ms376 KiB
#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define ll long long
//#define int ll
#define ld long double
#define endl '\n'
#define TIME 1.0*clock()/CLOCKS_PER_SEC

using namespace std;

mt19937 gen(chrono::system_clock::now().time_since_epoch().count());

const int M = 1e9 + 7;
const int FFTM = 998244353;
const int N = 2e5 + 7;

int n, a[N], x;

pair<int,int> f(int l){
    pair<int,int> res;
    int cur = 0;
    for (int i = 0; i < l; i++)
        cur ^= a[i];
    if (cur >= x) return {1, 1};
    for (int i = l; i < n; i++){
        cur ^= a[i - l], cur ^= a[i];
        if (cur >= x) return {1, i - l + 2};
    }
    return {0, 0};
}

main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef LOCAL
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    cin >> n >> x;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    int l = 0, r = n, res = 0;
    while (l <= r){
        int m = (l + r)>>1;
        if (f(m).F){
            res = max(res, m);
            l = m + 1;
        }
        else r = m - 1;
    }
    cout << f(res).S << ' ' << res;
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

xor.cpp:35:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...