QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#595228#7747. Memoryrxzfn639WA 13ms5300kbC++231.3kb2024-09-28 13:05:462024-09-28 13:05:46

Judging History

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

  • [2024-09-28 13:05:46]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:5300kb
  • [2024-09-28 13:05:46]
  • 提交

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] << 64;
        for (int j = 1; j <= 64; j++) {
            if (ans[i - j] == 0) break;
            res += a[i - j] << (64 - 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;
}

詳細信息

Test #1:

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

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

input:

10
-1 36 18 18 18 18 18 18 18 -18

output:

-++++++++-

result:

ok single line: '-++++++++-'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3620kb

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: 0
Accepted
time: 13ms
memory: 5300kb

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:

ok single line: '-+++++++++++++++++++++++++++++...++++++++++++++++++++++++++++++-'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

10
-1 70 -35 -72 36 12 -6 42 -21 -84

output:

-+---+-+--

result:

ok single line: '-+---+-+--'

Test #6:

score: -100
Wrong Answer
time: 1ms
memory: 3500kb

input:

1000
-1 -120742 60371 -567374 283687 -507718 253859 -579246 289623 21402 -10701 539474 -269737 -681332 340666 -746052 373026 -993382 496691 -333880 166940 -632724 316362 909690 -454845 86680 -43340 236688 -118344 -29102 14551 6252 -3126 -440612 220306 -878460 439230 649538 -324769 -651632 325816 882...

output:

---------+-+-----------+-+-+---+-----+---+-+-+---+-+-+-+-+---+----+++-+-++---++++-+-+++----+-+++--+++--+++-----++------+-+--++--+-++-++++---+--+-+++++-++-+----+--+--+++-+--+-+--++-+-+--+-+++--+-+--+---++++-++-+---+-+-++++-++-+++++-+----+-+-++--+-+++----+-+++++++-+++-+--++-+-++------+--++-+-+-+-+-++-...

result:

wrong answer 1st lines differ - expected: '---------+-+-----------+-+-+--...+---+-+-+-+-+-----+-+---------+', found: '---------+-+-----------+-+-+--...++-++++-+-++++-+-++-+--------++'