Submission #967931

#TimeUsernameProblemLanguageResultExecution timeMemory
967931PringBinaria (CCO23_day1problem1)C++17
6 / 25
1 ms452 KiB
#include <bits/stdc++.h> using namespace std; #ifdef MIKU string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m"; #define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x) void dout() { cout << dbrs << endl; } template <typename T, typename ...U> void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); } #else #define debug(...) 39 #endif #define fs first #define sc second #define mp make_pair #define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++) using ll = long long; typedef pair<int, int> pii; const int MXN = 20, mod = 1000003; int n, k; int a[MXN]; bool check(string s) { int now = 0; FOR(i, 0, k - 1) now += (s[i] & 1); FOR(i, k - 1, n) { now += (s[i] & 1); if (now != a[i]) return false; now -= (s[i - (k - 1)] & 1); } debug(s); return true; } void miku() { cin >> n >> k; FOR(i, k - 1, n) cin >> a[i]; int ans = 0; FOR(I, 0, (1 << n)) { string s; FOR(w, 0, n) s.push_back((I & (1 << w)) ? '1' : '0'); ans += check(s); } cout << ans << '\n'; } int32_t main() { cin.tie(0) -> sync_with_stdio(false); cin.exceptions(cin.failbit); miku(); return 0; }

Compilation message (stderr)

Main.cpp: In function 'bool check(std::string)':
Main.cpp:11:20: warning: statement has no effect [-Wunused-value]
   11 | #define debug(...) 39
      |                    ^~
Main.cpp:33:5: note: in expansion of macro 'debug'
   33 |     debug(s);
      |     ^~~~~
#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...