이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <set>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <fstream>
#include <complex>
#include <stack>
#include <bitset>
#include <set>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define ll long long int
#define vi vector<int>
#define ii pair<ll,ll>
#define pb push_back
#define mp make_pair
#define vv vector
#define ff first
#define ss second
#define pll pair<ll,ll>
#define cd complex<double>
#define ld long double
#define pld pair<ld,ld>
#define iii pair<ii,int>
using namespace std;
const ll MOD = 998244353;
bool isV(int* arr,int n,int l,int r){
int x = 0;
int v = (1<<n)-1;
n = 1 << n;
FORE(i,l,r)x ^= arr[i];
if(x == v)return 1;
//cout << l << " " << r << " " << v << " " << x << endl;
FOR(i,n){
if(l <= i and i <= r)continue;
FOR(j,n){
if(j < l or j > r)continue;
//cout << i << " " << j << endl;
if((x^arr[i]^arr[j]) == v){
return 1;
}
}
}
cout << l+1 << " " << r+1 << " " << x << endl;
return 0;
}
#define endl '\n'
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
int n2 = n;
n = 1<<n;
int arr[n];
FOR(i,n)cin >> arr[i];
int ctr = 0;
FOR(i,n){
FOR(j,n){
int sum = 0;
FORE(x,i,j)sum ^= arr[x];
if(i < j and sum == 0){
ctr++;
//cout << "OO : " << i+1 << " " << j+1 << endl;
}
if(i <= j){
//ctr += isV(arr,n2,i,j);
}else{
//cout << i+1 << " " << j+1 << endl;
}
}
}
cout << ctr << endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
dojave.cpp: In function 'int main()':
dojave.cpp:71:9: warning: unused variable 'n2' [-Wunused-variable]
int n2 = n;
^~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |