QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#595261#7747. MemoryAmiyaCastWA 1ms5844kbC++141.1kb2024-09-28 13:11:412024-09-28 13:11:42

Judging History

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

  • [2024-09-28 13:11:42]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5844kb
  • [2024-09-28 13:11:41]
  • 提交

answer

#include<bits/stdc++.h>
#define ll __int128
#define pii make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define per(i,b,a) for(int i=b;i>=a;--i)
const ll inf = 1145141919810;
using namespace std;
inline ll read() {
	ll x=0,f=1;
	char c=getchar();
	while (c<'0' || c>'9') {
		if (c=='-')  f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9') {
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
inline void print(ll x) {
	if(x < 0) putchar('-'), x = -x;
	if(x > 9) print(x / 10);
	putchar(x % 10 + '0');
	return ;
}
inline void pprint(ll x) {
	print(x);
	puts("");
}
#define double long double
const int N = 2e5 + 7;
double a[N], n;
double f[N];
const double eps = 1e-20;
int sgn(double x){
	if(fabs(x) < eps) return 0;
	else if(x > 0) return 1;
	else return -1;
}
int main() {
	n = read();
	rep(i, 1, n) a[i] = read();
	rep(i, 1, n){
		f[i] = f[i - 1] * 0.5 + a[i];
		if(sgn(f[i]) == 0) putchar('0');
		else if(sgn(f[i]) > 0) putchar('+');
		else if(sgn(f[i]) < 0) putchar('-');
	}
	return 0;
}

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

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5656kb

input:

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

output:

+0+-+---+-

result:

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

Test #2:

score: 0
Accepted
time: 1ms
memory: 5844kb

input:

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

output:

-++++++++-

result:

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

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 5660kb

input:

1000
-1 193552 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 967...

output:

-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

result:

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