QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#626823 | #7747. Memory | 287029 | WA | 6ms | 3772kb | C++14 | 1.2kb | 2024-10-10 13:20:59 | 2024-10-10 13:20:59 |
Judging History
answer
#include <bits/stdc++.h>
#define bit(x) (1LL << (x))
#define lowbit(x) (x & (-x))
#define SQU(x) ((x) * (x))
#define ls id << 1
#define rs id << 1 | 1
//#define int long long
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn = 2e5 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
const int inv2 = (mod + 1) / 2;
ll qpow(ll x,ll y) {
ll res = 1;
while(y) {
if(y & 1) res = res * x % mod;
x = x * x % mod;
y >>= 1;
}
return res;
}
void add(int &x,int y) {
x += y;
if(x >= mod) x -= mod;
}
const int dx[] = {0,0,1,-1};
const int dy[] = {1,-1,0,0};
void solve() {
int n;cin >> n;
ll pre = 0;
string ans = "";
for(int i = 0;i < n;i++) {
int x;cin >> x;
pre += x * 2;
if(pre == 0) ans += "0";
else if(pre > 0) ans += "+";
else ans += "-";
// cout << pre << '\n';
pre /= 2;
}
cout << ans << '\n';
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout << fixed << setprecision(20);
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
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: 3668kb
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: 3560kb
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: 6ms
memory: 3740kb
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: -100
Wrong Answer
time: 0ms
memory: 3772kb
input:
10 -1 70 -35 -72 36 12 -6 42 -21 -84
output:
-+--0+0+0-
result:
wrong answer 1st lines differ - expected: '-+---+-+--', found: '-+--0+0+0-'