Submission #106541
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++11 (GCC 4.8.1) |
Score | 0 |
Code Size | 2456 Byte |
Status | TLE |
Exec Time | 1540 ms |
Memory | 6300 KB |
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 100 | ||||
Status |
|
Set Name | Test Cases |
---|---|
All | 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 3, 30, 31, 4, 5, 6, 7, 8, 9 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
1 | AC | 216 ms | 1060 KB |
10 | AC | 29 ms | 1048 KB |
11 | AC | 29 ms | 1084 KB |
12 | AC | 29 ms | 1124 KB |
13 | AC | 33 ms | 1304 KB |
14 | TLE | 1536 ms | 1532 KB |
15 | AC | 38 ms | 1568 KB |
16 | TLE | 1536 ms | 3880 KB |
17 | AC | 61 ms | 2728 KB |
18 | AC | 133 ms | 6300 KB |
19 | AC | 1136 ms | 1060 KB |
2 | AC | 52 ms | 1056 KB |
20 | AC | 870 ms | 1052 KB |
21 | AC | 311 ms | 1084 KB |
22 | TLE | 1536 ms | 1052 KB |
23 | TLE | 1535 ms | 1176 KB |
24 | TLE | 1536 ms | 1172 KB |
25 | TLE | 1536 ms | 1320 KB |
26 | TLE | 1538 ms | 1184 KB |
27 | TLE | 1535 ms | 1436 KB |
28 | TLE | 1540 ms | 4512 KB |
29 | AC | 910 ms | 4896 KB |
3 | AC | 81 ms | 1088 KB |
30 | TLE | 1536 ms | 3580 KB |
31 | TLE | 1537 ms | 6040 KB |
4 | AC | 51 ms | 1088 KB |
5 | AC | 27 ms | 1148 KB |
6 | AC | 31 ms | 1152 KB |
7 | AC | 28 ms | 1156 KB |
8 | AC | 29 ms | 1056 KB |
9 | TLE | 1535 ms | 1216 KB |