제출 #1111079

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

#define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define all(x) x.begin(), x.end()
#define lnl long long
#define pq priority_queue
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define F first
#define S second

using namespace std;

lnl dp[250000];

void solve () {
	lnl n, s; cin >> n >> s;
	dp[0] = 0;
	for (int i = 1; i <= n; i++) {
		lnl x; cin >> x;
		dp[i] = dp[i-1]^x;
	}
	int mx = 0, id;

	for (int i = n; i > mx; i--)
	for (int j = 0; j <= n-i; j++)
		if (dp[j]^dp[j+i] > s && i > mx) {mx = i; id = j+1;}
	
	cout << id << ' ' << mx;
}
int main() {IOS solve(); return 0;}

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

xor.cpp: In function 'void solve()':
xor.cpp:30:21: warning: suggest parentheses around comparison in operand of '^' [-Wparentheses]
   30 |   if (dp[j]^dp[j+i] > s && i > mx) {mx = i; id = j+1;}
      |             ~~~~~~~~^~~
xor.cpp:32:16: warning: 'id' may be used uninitialized in this function [-Wmaybe-uninitialized]
   32 |  cout << id << ' ' << mx;
      |                ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...