QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#595172#7747. Memorymhw#TL 0ms0kbC++231.3kb2024-09-28 12:50:312024-09-28 12:50:33

Judging History

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

  • [2024-09-28 12:50:33]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-09-28 12:50:31]
  • 提交

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

output:


result: