Submission #69315149
Source Code Expand
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long int ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vector<bool> ok(n + 1); vector<int> l(n); for (int i = 0; i < n; ++i) { cin >> l[i]; } ok[0] = ok.back() = true; for (int i = 0; i < n; ++i) { if (ok[i] and !l[i]) { ok[i + 1] = true; } } for (int i = n - 1; i >= 0; --i) { if (ok[i + 1] and !l[i]) { ok[i] = true; } } int res = 0; for (auto &&i : ok) { if (!i) res += 1; } cout << res << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - Locked Rooms |
User | KKT89 |
Language | C++ 20 (gcc 12.2) |
Score | 200 |
Code Size | 854 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 3620 KiB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample00.txt, sample01.txt, sample02.txt |
All | sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample00.txt | AC | 1 ms | 3492 KiB |
sample01.txt | AC | 1 ms | 3412 KiB |
sample02.txt | AC | 1 ms | 3488 KiB |
testcase00.txt | AC | 1 ms | 3492 KiB |
testcase01.txt | AC | 1 ms | 3620 KiB |
testcase02.txt | AC | 1 ms | 3544 KiB |
testcase03.txt | AC | 1 ms | 3536 KiB |
testcase04.txt | AC | 1 ms | 3488 KiB |
testcase05.txt | AC | 1 ms | 3492 KiB |
testcase06.txt | AC | 1 ms | 3484 KiB |
testcase07.txt | AC | 1 ms | 3416 KiB |
testcase08.txt | AC | 1 ms | 3500 KiB |
testcase09.txt | AC | 1 ms | 3548 KiB |
testcase10.txt | AC | 1 ms | 3616 KiB |
testcase11.txt | AC | 1 ms | 3488 KiB |
testcase12.txt | AC | 1 ms | 3472 KiB |
testcase13.txt | AC | 1 ms | 3492 KiB |
testcase14.txt | AC | 1 ms | 3496 KiB |
testcase15.txt | AC | 1 ms | 3488 KiB |
testcase16.txt | AC | 1 ms | 3360 KiB |
testcase17.txt | AC | 1 ms | 3476 KiB |
testcase18.txt | AC | 1 ms | 3360 KiB |
testcase19.txt | AC | 1 ms | 3544 KiB |
testcase20.txt | AC | 1 ms | 3496 KiB |
testcase21.txt | AC | 1 ms | 3480 KiB |
testcase22.txt | AC | 1 ms | 3484 KiB |
testcase23.txt | AC | 1 ms | 3500 KiB |