# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
949484 | MilosMilutinovic | 빌딩 장식 3 (JOI15_building3) | C++14 | 70 ms | 21184 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> b(n - 1);
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
}
vector<int> mx(n - 1);
vector<bool> good(n - 1);
for (int i = 0; i < n - 1; i++) {
mx[i] = (i == 0 ? b[i] : max(mx[i - 1], b[i]));
if (i == 0) {
good[i] = (b[i] == 1);
} else {
good[i] = (good[i - 1] & (b[i] <= mx[i - 1] + 1));
}
}
long long ans = 0;
{
vector<int> seq;
seq.push_back(1);
for (int i = 0; i < n - 1; i++) {
seq.push_back(b[i]);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |