QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#637736#7747. Memoryzzuqy#WA 0ms3884kbC++14727b2024-10-13 13:56:342024-10-13 13:56:35

Judging History

你现在查看的是最新测评结果

  • [2024-10-13 13:56:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3884kb
  • [2024-10-13 13:56:34]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define rep(a,b,c) for(int c=a;c<=b;++c)
using namespace std;
int n,a[1000009],sum;

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	ll S=0,T=0;
	rep(1,n,i)
	{
		S+=a[i];
		if(S==0&&T==0)printf("0");
		else
		{
			if(S>0||(S>=0&&T>=0))printf("+");
			else printf("-");
		}
		if(S==0);
		else
		{
			if(T)
			{
				T=S>0?1:-1;
			}
			else
			{
				if(S&1)T=S>0?1:-1;
			}
			S/=2;
		}
	}
	return 0; 
}
/*
100
2 -1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3768kb

input:

10
2 -1 4 -7 4 -8 3 -6 4 -7

output:

+0+-+---+-

result:

ok single line: '+0+-+---+-'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3884kb

input:

10
-1 36 18 18 18 18 18 18 18 -18

output:

-+++++++++

result:

wrong answer 1st lines differ - expected: '-++++++++-', found: '-+++++++++'