Submission #571477

# Submission time Handle Problem Language Result Execution time Memory
571477 2022-06-02T09:53:43 Z nttt XOR (IZhO12_xor) C++14
0 / 100
2 ms 340 KB
#include<bits/stdc++.h>
using namespace std;
#define MASK(i) (1LL << (i))
#define BIT(x, i) ((x >> (i)) & 1)
#define fi first
#define se second
#define ll long long
#define task "C" 

const int oo = 1e9 + 7;
const ll loo = (ll)1e18 + 7;
const int MOD = 1e9 + 7;
const int N = 2e6 + 3;
const int BASE = 10;

template <typename T1, typename T2> bool minimize(T1 &a, T2 b)
{
    if (a > b) {a = b; return true;} return false;
}
template <typename T1, typename T2> bool maximize(T1 &a, T2 b)
{
    if (a < b) {a = b; return true;} return false;
}

int n, x;
int a[N];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    freopen(task".in" , "r" , stdin);
    freopen(task".out" , "w" , stdout);
    cin >> n >> x;
    for (int i = 1; i <= n; i++) cin >> a[i];
    pair<int, int> ans;
    for (int i = 1; i <= n; i++)
    {
        int s = 0;
        for (int k = i; k <= n; k++)
        {
            s ^= a[k];
            if(s >= x && k - i > ans.se - ans.fi ) ans = make_pair(i, k);
        }
    }
    cout << ans.fi << " " << ans.se - ans.fi + 1;
    return 0;
}

Compilation message

xor.cpp: In function 'int main()':
xor.cpp:30:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |     freopen(task".in" , "r" , stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
xor.cpp:31:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |     freopen(task".out" , "w" , stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -