QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#595159 | #7747. Memory | rxzfn639 | WA | 10ms | 4784kb | C++23 | 879b | 2024-09-28 12:45:38 | 2024-09-28 12:45:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const i64 P = 998244353;
const i64 inf = 1ll << 62;
void solve() {
int n;
cin >> n;
vector<i64> a(n + 1), ans(n + 1);
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n; i++) {
i64 res = a[i] << 32;
for (int j = 1; j <= 32; j++) {
if (ans[i - j] == 0 || res >= inf) break;
res += a[i - j] << (32 - 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: 3612kb
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: 3820kb
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: 3568kb
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: 10ms
memory: 4784kb
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: 3592kb
input:
10 -1 70 -35 -72 36 12 -6 42 -21 -84
output:
-+---+-+--
result:
ok single line: '-+---+-+--'
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 3568kb
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: '---------+-+-----------+-+-+--...++--+-+-+++-+----++-+--+---+--+'