Submission #967943

#TimeUsernameProblemLanguageResultExecution timeMemory
967943Gromp15Binaria (CCO23_day1problem1)C++17
6 / 25
1 ms604 KiB
#include <bits/stdc++.h> #define ll long long #define ar array #define db double #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define rint(l, r) uniform_int_distribution<int>(l, r)(rng) template<typename T> bool ckmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; } template<typename T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } void test_case() { int n, k; cin >> n >> k; vector<int> a(n-k+1); for (int &x : a) cin >> x; int ans = 0; for (int m = 0; m < 1 << n; m++) { vector<int> p(n-k+1); for (int i = 0; i < n; i++) p[i] = (m >> i & 1) + (i ? p[i-1] : 0); bool ok = 1; for (int i = 0; i < n-k+1; i++) { if (p[i+k-1] - (i ? p[i-1] : 0) != a[i]) { ok = 0; break; } } ans += ok; } cout << ans << '\n'; } int main() { cin.tie(0)->sync_with_stdio(0); int t = 1; // cin >> t; while (t--) test_case(); }
#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...