QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#272249 | #7877. Balanced Array | ucup-team1321# | WA | 1ms | 3620kb | C++20 | 1.0kb | 2023-12-02 16:38:51 | 2023-12-02 16:39:14 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
int a[N];
int digit(char a) {
if ('0' <= a && a <= '9') return a - '0';
if ('a' <= a && a <= 'z') return a - 'a' + 10;
return a - 'A' + 36;
}
int read() {
string s;
cin >> s;
int x = 0;
for (char a : s)
x = x * 62 + a;
return x;
}
vector<int> avail;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
for (int i = 1; i <= n; i++) a[i] = read();
cout << "00";
for (int i = 3; i <= n; i++) {
if ((i - 1) % 2 == 0) {
avail.push_back((i - 1) / 2);
}
vector<int> nv;
for (int k : avail) {
if (a[i] + a[i - 2 * k] == 2 * a[i - k]) {
nv.push_back(k);
}
}
avail.swap(nv);
if (avail.size() > 100) avail.resize(100);
if (avail.size()) {
cout << 1;
} else {
cout << 0;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3500kb
input:
3 1 2 3
output:
001
result:
ok single line: '001'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
9 1 2 3 2 5 4 3 8 5
output:
001010111
result:
ok single line: '001010111'
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3620kb
input:
9 1C 3f 4S 3h 88 6x 4W d1 8c
output:
000000000
result:
wrong answer 1st lines differ - expected: '001010111', found: '000000000'