QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#595173#7747. Memorymhw#WA 1ms3608kbC++231.3kb2024-09-28 12:51:112024-09-28 12:51:12

Judging History

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

  • [2024-09-28 12:51:12]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3608kb
  • [2024-09-28 12:51:11]
  • 提交

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;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3544kb

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: 3608kb

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: 3564kb

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: '------------------------------...-------------------------------'