记录详情

Time Exceeded

/in/foo.cc: In function 'void doit2()':
/in/foo.cc:30:25: warning: iteration 40 invokes undefined behavior [-Waggressive-loop-optimizations]
   For(j,0,60) if(x&(tw[j])) ans1[j][1]^=x;else ans1[j][0]^=x;
                    ~~~~~^~
/in/foo.cc:8:32: note: within this loop
 #define For(i,j,k) for(ll i=j;i<=k;i++)
                                 
/in/foo.cc:30:7:
   For(j,0,60) if(x&(tw[j])) ans1[j][1]^=x;else ans1[j][0]^=x;
       ~~~~~                     
/in/foo.cc:30:3: note: in expansion of macro 'For'
   For(j,0,60) if(x&(tw[j])) ans1[j][1]^=x;else ans1[j][0]^=x;
   ^~~
/in/foo.cc:26:26: warning: iteration 40 invokes undefined behavior [-Waggressive-loop-optimizations]
  For(i,1,60) tw[i]=tw[i-1]*2LL;
                    ~~~~~~^
/in/foo.cc:8:32: note: within this loop
 #define For(i,j,k) for(ll i=j;i<=k;i++)
                                 
/in/foo.cc:26:6:
  For(i,1,60) tw[i]=tw[i-1]*2LL;
      ~~~~~                      
/in/foo.cc:26:2: note: in expansion of macro 'For'
  For(i,1,60) tw[i]=tw[i-1]*2LL;
  ^~~
# 状态 耗时 内存占用
#1 Time Exceeded ≥1006ms ≥380.0 KiB
#2 Accepted 3ms 384.0 KiB
#3 Accepted 11ms 324.0 KiB
#4 Accepted 16ms 308.0 KiB
#5 Wrong Answer 21ms 384.0 KiB
#6 Wrong Answer 16ms 256.0 KiB
#7 Wrong Answer 18ms 356.0 KiB
#8 Wrong Answer 18ms 312.0 KiB
#9 Wrong Answer 8ms 484.0 KiB
#10 Wrong Answer 7ms 356.0 KiB

代码

#include <iostream>
#include <cstdio>
#include<algorithm>
#define inf 1e9
#define ll long long
#define maxn 401000
#define y1 fuck
#define For(i,j,k) for(ll i=j;i<=k;i++)
#define Dow(i,j,k) for(ll i=k;i>=j;i--)
using namespace std;
inline ll read(){   ll x=0,f=1;char ch=getchar();   while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}  while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}  return x*f; }
inline void write(ll x){    if (x<0) putchar('-'),x=-x; if (x>=10) write(x/10);   putchar(x%10+'0');  }
inline void writeln(ll x){write(x);puts("");}
inline void write_p(ll x){write(x);putchar(' ');}
ll n,k,ans1[40][2],tw[40],x;
inline void doit1()
{
	ll ans=0;
	For(i,1,n)	x=read(),ans^=x;
	writeln(ans);
	exit(0);
}
inline void doit2()
{
	tw[0]=1;
	For(i,1,60)	tw[i]=tw[i-1]*2LL;
	For(i,1,n)
	{
		x=read();
		For(j,0,60)	if(x&(tw[j]))	ans1[j][1]^=x;else ans1[j][0]^=x;
	}
	For(i,1,60)	if(ans1[i][1]!=ans1[i][0]&&ans1[i][1]!=0&&ans1[i][0]!=0)	{writeln(min(ans1[i][1],ans1[i][0])),writeln(max(ans1[i][1],ans1[i][0]));exit(0);}
}
int main()
{
//	freopen("water.in","r",stdin);freopen("water.out","w",stdout);
	n=read();k=read();
	if(k==1)	doit1();
	if(k==2)	doit2();
}

信息

递交者
类型
递交
题目
亚由题
语言
C++
递交时间
2017-08-19 12:21:26
评测时间
2017-08-19 12:21:26
评测机
分数
30
总耗时
≥1129ms
峰值内存
≥484.0 KiB