Submission #381539

#TimeUsernameProblemLanguageResultExecution timeMemory
381539kartelSemafor (COI20_semafor)C++14
6 / 100
3 ms1004 KiB
#include <bits/stdc++.h> #define in(x) freopen(x, "r", stdin) #define out(x) freopen(x, "w", stdout) //#include <time.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("-O3") #define F first #define S second #define pb push_back #define M ll(1e9 + 7) //#define M ll(998244353) #define sz(x) (int)x.size() #define re return #define oo ll(1e18) #define el '\n' #define pii pair <int, int> #define all(x) (x).begin(), (x).end() #define arr_all(x, n) (x + 1), (x + 1 + n) #define vi vector<int> #define eps (ld)1e-9 using namespace std; typedef long long ll; //using namespace __gnu_pbds; //typedef tree <ll, null_type, less_equal <ll> , rb_tree_tag, tree_order_statistics_node_update> ordered_set; typedef double ld; typedef unsigned long long ull; typedef short int si; int sum(int x, int y) {return (x + y) % M;} int digits[10] = {10, 2, 9, 7, 18, 21, 12, 3, 29, 23}; bool isd[(1 << 6)]; ll n, m, k, x; int f[15][(1 << 6)]; int main() { // mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());; ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // in("toys.in"); // out("toys.out"); // in("input.txt"); // out("output.txt"); // cerr.precision(9); cerr << fixed; // clock_t tStart = clock(); cin >> m >> n >> k >> x; f[0][digits[x]] = 1; for (int i = 0; i < 10; i++) { isd[digits[i]] = 1; } for (int i = 0; i <= n; i++) { if (i % k == 0) { for (int mask = 0; mask < (1 << 5); mask++) { if (!isd[mask]) { f[i][mask] = 0; } } } for (int mask = 0; mask < (1 << 5); mask++) { for (int j = 0; j < 5; j++) { int nmask = (mask ^ (1 << j)); f[i + 1][nmask] = sum(f[i + 1][nmask], f[i][mask]); } } } for (int i = 0; i <= 9; i++) { cout << f[n][digits[i]] << el; } }
#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...