QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#595172 | #7747. Memory | mhw# | TL | 0ms | 0kb | C++23 | 1.3kb | 2024-09-28 12:50:31 | 2024-09-28 12:50:33 |
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = __int128_t;
const i64 P = 998244353;
const i64 inf = 1ll << 62;
// 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] << 110;
for (int j = 1; j <= 110; j++) {
if (ans[i - j] == 0) break;
res += a[i - j] << (110 - j);
}
if (res < 0) ans[i] = -1;
else if (res == 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: 0
Time Limit Exceeded
input:
10 2 -1 4 -7 4 -8 3 -6 4 -7