QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#637956 | #7747. Memory | ShwStone | WA | 0ms | 3764kb | C++14 | 756b | 2024-10-13 14:28:19 | 2024-10-13 14:28:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int MAXN(2e5 + 5);
int n;
int cnt[MAXN], d[MAXN];
int main() {
scanf("%d", &n);
int pre = 0;
for (int i = 1; i <= n; i++) {
int x, c = 1;
scanf("%d", &x);
if (x < 0) x = -x, c = -1;
for (int j = 0; j < 32; j++) {
cnt[i + j] += c * ((x >> j) & 1);
}
int cc = pre, dd = d[i - 1];
for (int j = 0; j < 32; j++) {
if (dd % 2) cc = dd % 2;
dd = cnt[i + j] + dd / 2;
}
if (dd > 0) putchar('+');
else if (dd < 0) putchar('-');
else {
if (cc > 0) putchar('+');
else if (cc < 0) putchar('-');
else putchar('=');
}
if (d[i - 1] % 2) pre = d[i - 1] % 2;
d[i] = cnt[i] + d[i - 1] / 2;
}
putchar('\n');
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3764kb
input:
10 2 -1 4 -7 4 -8 3 -6 4 -7
output:
+=+-+---+-
result:
wrong answer 1st lines differ - expected: '+0+-+---+-', found: '+=+-+---+-'