Submission #887950

#TimeUsernameProblemLanguageResultExecution timeMemory
887950fanwenBinaria (CCO23_day1problem1)C++17
6 / 25
1 ms604 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define ll long long #define file(name) \ if(fopen(name".inp", "r")) \ freopen(name".inp", "r", stdin), freopen(name".out", "w", stdout); const int Mod = 1e6 + 3; const int MAX = 1e6 + 5; int n, k, a[MAX]; namespace sub1 { bool check() { return n <= 10; } void solve() { int ans = 0; for (int mask = 0; mask < (1 << n); ++mask) { bool oke = true; int sum = 0; for (int i = 0; i < n; ++i) { sum += (mask >> i & 1); if(i >= k) sum -= (mask >> (i - k) & 1); if(i + 1 >= k) oke &= a[i + 1 - k] == sum; } ans += oke; } cout << ans; exit(0); } } void you_make_it(void) { cin >> n >> k; for (int i = 0; i < n - k + 1; ++i) cin >> a[i]; reverse(a, a + n - k + 1); if(sub1::check()) sub1::solve(); } signed main() { #ifdef LOCAL freopen("TASK.inp", "r", stdin); freopen("TASK.out", "w", stdout); #endif auto start_time = chrono::steady_clock::now(); cin.tie(0), cout.tie(0) -> sync_with_stdio(0); you_make_it(); auto end_time = chrono::steady_clock::now(); cerr << "\nExecution time : " << chrono::duration_cast <chrono::milliseconds> (end_time - start_time).count() << "[ms]" << endl; return (0 ^ 0); } // Dream it. Wish it. Do it.
#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...