Submission #106540


Source Code Expand

#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>
#include <cassert>
using namespace std;

//common
using i32=int;using i64=long long;using ll =i64;
#define BR "\n"

#define ALL(c) c.begin(),c.end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define EACH(it,list) for(auto it = list.begin(); it != list.end(); ++it)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))

//config
#define MODE_DEBUG
//#define INF 1<<30
//#define EPS 1e-8
//const ll MOD =100000007;

//Mat
//template <typename T> using Mat = vector<vector<T>>;//H*W M*N
//template <typename T> using Mat3 = vector<Mat<T>>;

#define H(Map) Map.size()
#define W(Map) Map[0].size()

//debug
#ifdef MODE_DEBUG
#define  DUMP(x)  cerr << #x << " = "<< (x) <<endl
#define DEBUG(x) DUMP(x) << " (L" << __LINE__ << ")" << " " << __FILE__
#define CHECK(exp,act)  if(exp!=act){DUMP(exp);DEBUG(act);}
#define STOP(e)  CHECK(e);if(!(e)) exit(1);
#else
#define DUMP(x)
#define DEBUG(x)
#define CHECK(exp,act)
#define STOP(e)
#endif


//debug
template<class T> inline string toString(const vector<T>& x) {
	stringstream ss;
	REP(i,x.size()){
		if(i!=0)ss<<" ";
		ss<< x[i];
		//DUMP(v);
	}
	return ss.str();
}
template<class T> inline string toString(const vector<vector<T>>& map) {
	string res;stringstream ss;
	REP(i,map.size()){
		if(i!=0)ss<<BR;
		ss<< toString(map[i]);
	}
	return ss.str();
}
template<class K,class V>  string toString(map<K,V>& x) {
	string res;stringstream ss;
	for(auto& p:x)res << p.first<<":" << p.second<<" ";
	ss>>res;return res;
}

template<typename T,typename V> inline T pmod(T v,V MOD){
	int r=v%MOD;
	return r<0?r+MOD:r;
}

ll MOD =1000000007;

int main(){
	int N;cin >>N;
	vector<int> as(N);
	REP(i,N){
		int v;cin >>v;
		as[i]=v;
	}

	vector<int> ss(N+1);
	for(int i=1;i<N+1;i++)ss[i]=ss[i-1]^as[i-1];

	map<int,int> hash;
	for(int i=1;i<N+1;i++)	{
		hash.insert(make_pair(ss[i],i));
	}
	for(int v=(1<<20)-1;v>=0;v--){
		for(int i=0;i<N;i++){
			if(hash.find(v^ss[i])!=hash.end()){
				pair<int,int> s=*hash.find(v^ss[i]);
				cout<< v << " "<< i+1<< " "<<s.second<<endl;
				return 0;
			}
		}
	}
	return 0;
}

Submission Info

Submission Time
Task F - Maximum Segment XOR
User shimomire
Language C++ (GCC 4.4.7)
Score 0
Code Size 2456 Byte
Status CE

Compile Error

./Main.cpp:23: error: expected nested-name-specifier before ‘i32’
./Main.cpp:23: error: ‘i32’ has not been declared
./Main.cpp:23: error: expected ‘;’ before ‘=’ token
./Main.cpp:23: error: expected unqualified-id before ‘=’ token
./Main.cpp:23: error: expected nested-name-specifier before ‘i64’
./Main.cpp:23: error: ‘i64’ has not been declared
./Main.cpp:23: error: expected ‘;’ before ‘=’ token
./Main.cpp:23: error: expected unqualified-id before ‘=’ token
./Main.cpp:23: error: expected nested-name-specifier before ‘ll’
./Main.cpp:23: error: ‘ll’ has not been declared
./Main.cpp:23: error: expected ‘;’ before ‘=’ token
./Main.cpp:23: error: expected unqualified-id before ‘=’ token
./Main.cpp:68: error: ‘&’ cannot appear in a constant-expression
./Main.cpp:68: error: ‘>>’ should be ‘> >’ within a nested template argument list
./Main.cpp: In function ‘std::string toString(std::map<K, V, std::less<_Key>, std::allocator<std::pair<const _Ke...