QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#595226 | #7747. Memory | rxzfn639 | WA | 18ms | 5212kb | C++23 | 1.3kb | 2024-09-28 13:05:15 | 2024-09-28 13:05:19 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = __int128_t;
const i64 P = 998244353;
// int128读入写出板子,不能关流
template <class T>
inline void read(T &x) {
x = 0;
char c = getchar();
bool f = 0;
for (; !isdigit(c); c = getchar())
f ^= (c == '-');
for (; isdigit(c); c = getchar())
x = (x << 3) + (x << 1) + (c ^ 48);
x = f ? -x : x;
}
template <class T>
inline void write(T x) {
if (x < 0) putchar('-'), x = -x;
if (x < 10) putchar(x + 48);
else write(x / 10), putchar(x % 10 + 48);
}
void solve() {
int n;
cin >> n;
vector<i64> a(n + 1);
vector<int> ans(n + 1);
for (int i = 1; i <= n; i++) read<i64>(a[i]);
for (int i = 1; i <= n; i++) {
i64 res = a[i] << 100;
for (int j = 1; j <= 100; j++) {
if (ans[i - j] == 0) break;
res += a[i - j] << (100 - j);
}
if (res < (i64)0) ans[i] = -1;
else if (res == (i64)0) ans[i] = 0;
else ans[i] = 1;
}
for (int i = 1; i <= n; i++) {
if (ans[i] < 0) cout << '-';
else if (ans[i] == 0) cout << '0';
else cout << '+';
}
}
int main() {
// ios::sync_with_stdio(0); cin.tie(0), cout.tie(0);
int t = 1;
// cin >> t;
while(t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3836kb
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: 0ms
memory: 3632kb
input:
10 -1 36 18 18 18 18 18 18 18 -18
output:
-++++++++-
result:
ok single line: '-++++++++-'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3816kb
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:
ok single line: '-+++++++++++++++++++++++++++++...++++++++++++++++++++++++++++++-'
Test #4:
score: -100
Wrong Answer
time: 18ms
memory: 5212kb
input:
100000 -1 696082628 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 ...
output:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------...
result:
wrong answer 1st lines differ - expected: '-+++++++++++++++++++++++++++++...++++++++++++++++++++++++++++++-', found: '------------------------------...-------------------------------'