제출 #1140360

#제출 시각아이디문제언어결과실행 시간메모리
1140360samy_nagyXOR (IZhO12_xor)C++20
0 / 100
28 ms33344 KiB
#include <bits/stdc++.h>
/// لتكن مشيئتك
#define int long long
#define ll long long
using namespace std;
const int N = 1e3 + 5, mod = 1e9 + 7;// 1e9+7, 998244353
/**
You have another chance now the decision is yours
 */
void solve() {
    int n, x;
    cin >> n >> x;
    int a[n];
    for (int i = 0; i < n and cin >> a[i]; ++i) {

    }
    for (int k = n; k > 0; --k) {
        int c = 0;
        for (int i = 0; i < k; ++i) {
            c ^= a[i];
        }
        if (c >= x) {
            cout << 1 << " " << k;
            return;
        }
        for (int i = k; i < n; ++i) {
            c ^= a[i - k];
            c ^= a[i];
            if (c >= x) {
                cout << i - k + 2 << " " << k;
                return;
            }
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    int tc = 1;
    // cin >> tc;
    for (int i = 1; i <= tc; ++i) {
        solve();
        //  cout << "\n";

    }
}

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

xor.cpp: In function 'int main()':
xor.cpp:42:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |     freopen("in.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
xor.cpp:43:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |     freopen("out.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...