Submission #897546

#TimeUsernameProblemLanguageResultExecution timeMemory
897546bleahbleahSecurity Guard (JOI23_guard)C++17
0 / 100
11 ms1116 KiB
#include <bits/stdc++.h> #define all(x) (x).begin(),(x).end() using namespace std; using ll = long long; using ld = long double; //#define int ll #define sz(x) ((int)(x).size()) using pii = pair<int,int>; using tii = tuple<int,int,int>; vector<int> S; signed main() { cin.tie(0) -> sync_with_stdio(0); int n, m, q; cin >> n >> m >> q; S.resize(n); for(auto &x : S) cin >> x; ll sum = 0; for(int i = 0; i < n - 1; i++) sum += (S[i] == S[i + 1]) * S[i]; S.erase(unique(all(S)), end(S)); for(int i = 0; i < n - 2; i++) { if(S[i] == S[i + 2] && S[i + 1] == 0) sum--; } cout << sum << '\n'; } /** nu toate numerele mari sunt semne de ceva bine -- Si pe mine m-a surprins sa fiu sincer, dar pbn cautati pe net, sunt sigur ca se gasesc mai multe exemple */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...