結果

問題 No.3569 Xor to Zero
コンテスト
ユーザー Aob-11
提出日時 2026-08-20 17:25:31
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.90.0)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 3,482 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,222 ms
コンパイル使用メモリ 352,380 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-08-20 17:25:45
合計ジャッジ時間 12,130 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 TLE * 2 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
// #include <windows.h>
// #include <bits/extc++.h>
// using namespace __gnu_pbds;
using namespace std;
//#pragma GCC optimize(3)
#define DB double
#define LL long long
#define ULL unsigned long long
#define uint unsigned int
#define in128 __int128
#define cint const int
#define cLL const LL
#define For(z,e1,e2) for(int z=(e1);z<=(e2);z++)
#define Rof(z,e1,e2) for(int z=(e2);z>=(e1);z--)
#define For_(z,e1,e2) for(int z=(e1);z<(e2);z++)
#define Rof_(z,e1,e2) for(int z=(e2);z>(e1);z--)
#define inint(e) scanf("%d",&e)
#define inll(e) scanf("%lld",&e)
#define inpr(e1,e2) scanf("%d%d",&e1,&e2)
#define in3(e1,e2,e3) scanf("%d%d%d",&e1,&e2,&e3)
#define outint(e) printf("%d\n",e)
#define outint_(e) printf("%d%c",e," \n"[i==n])
#define outint2_(e,e1,e2) printf("%d%c",e," \n"[(e1)==(e2)])
#define outll(e) printf("%lld\n",e)
#define outll_(e) printf("%lld%c",e," \n"[i==n])
#define outll2_(e,e1,e2) printf("%lld%c",e," \n"[(e1)==(e2)])
#define exc(e) if(e) continue
#define stop(e) if(e) break
#define ret(e) if(e) return
#define pb push_back
#define ft first
#define sc second
#define pii pair<int,int> 
#define pli pair<long long,int> 
#define pil pair<int,long long> 
#define vct vector 
#define clean(e) while(!e.empty()) e.pop()
#define all(ev) ev.begin(),ev.end()
#define sz(ev) ((int)ev.size())
#define x0 __xx00__
#define x1 __xx11__
#define y0 __yy00__
#define y1 __yy11__
#define ffo fflush(stdout)
cLL mod=998244353ll,G=404ll;
// cLL mod=1000000007ll;
// cLL mod[2]={1686688681ll,1666888681ll},base[2]={166686661ll,188868881ll};
template <typename Type> void get_min(Type &w1,const Type w2) { if(w2<w1) w1=w2; } template <typename Type> void get_max(Type &w1,const Type w2) { if(w2>w1) w1=w2; }
template <typename Type> Type lcm(Type X_,Type Y_) { return (X_/__gcd(X_,Y_)*Y_); }
template <typename Type> Type md(Type w1,const Type w2=mod) { w1%=w2; if(w1<(Type)0) w1+=w2; return w1; } template <typename Type> Type md_(Type w1,const Type w2=mod) { w1%=w2; if(w1<=(Type)0) w1+=w2; return w1; }
void ex_gcd(LL &X_,LL &Y_,cLL &A_,cLL B_) { if(!B_) { X_=1ll; Y_=0ll; return ; } ex_gcd(Y_,X_,B_,A_%B_); Y_-=(A_/B_)*X_; } LL inv(cLL A_,cLL B_=mod) { LL X_=0ll,Y_=0ll; ex_gcd(X_,Y_,A_,B_); if(X_<0ll) X_+=B_; return X_; }
void Add(LL &X_,cLL Y_,cLL M_=mod) { if((X_+=Y_)>=M_) X_-=M_; }
void Sub(LL &X_,cLL Y_,cLL M_=mod) { if((X_-=Y_)<0ll) X_+=M_; }
void add(LL &X_,cLL Y_,cLL M_=mod) { (X_+=Y_)%=M_; if(X_<0ll) X_+=M_; }
void mul(LL &X_,cLL Y_,cLL M_=mod) { (X_*=Y_)%=M_; }
LL pw(LL X_,LL Y_,cLL M_=mod) { LL S_=1ll; while(Y_) { if(Y_&1ll) mul(S_,X_,M_); Y_>>=1; mul(X_,X_,M_); } return S_; }
mt19937 gen(time(NULL));
int rnd(int l,int r) { return (int)(gen()%(r-l+1)+l); }
mt19937_64 genll(time(NULL));
LL rndll(LL l,LL r) { return (LL)(genll()%(r-l+1ll)+l); }

void main_init()
{
	
}
cint N=1.02e5;
int n;
int a[N];
void main_solve()
{
	inint(n);
	For(i,1,n) inint(a[i]);
	LL ans=0ll;
	For(m,1,n)
	{
		bool f=true;
		int x=0,w=0;
		Rof(i,1,m)
		{
			if(w<a[i])
			{
				f=true;
				x=1;
			}
			else
			{
				if(!f) f=true,x++;
				else
				{
					if(a[i]==1) f=false,x++;
					else f=true,x+=2;
				}
			}
			ans+=x;
			w^=a[i];
		}
	}
	outll(ans);
}
int main()
{
	// ios::sync_with_stdio(0); cin.tie(0);
	// freopen("in.txt","r",stdin);
	// freopen("out.txt","w",stdout);
	// srand(time(NULL));
	main_init();
	// int _; inint(_); For(__,1,_) // T>1 ?
		// printf("\n------------\n\n"),
		main_solve();
	// cerr<<clock()<<'\n';
	return 0;
}
/*

*/
0