Submission #557763

#TimeUsernameProblemLanguageResultExecution timeMemory
557763Yazan_AlattarSemafor (COI20_semafor)C++14
6 / 100
13 ms8412 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define F first #define S second #define pb push_back #define endl "\n" #define all(x) x.begin(), x.end() const int M = 10007; const ll inf = 2e9; const ll mod = 1e9 + 7; const double pi = acos(-1); const double eps = 1e-6; const int dx[] = {0, -1, 0, 1}, dy[] = {1, 0, -1, 0}; const int block = 320; ll m, n, k, x, dp[M][50], cost[20][20], sticks[M], ans; bool vist[50]; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // =======Construction========= sticks[1] = 2; sticks[2] = 9; sticks[3] = 7; sticks[4] = 18; sticks[5] = 21; sticks[6] = 12; sticks[7] = 3; sticks[8] = 29; sticks[9] = 23; sticks[0] = 10; vist[2] = vist[9] = 1; vist[7] = vist[18] = 1; vist[21] = vist[12] = 1; vist[3] = vist[29] = 1; vist[23] = vist[10] = 1; // ============================= cin >> m >> n >> k >> x; dp[0][sticks[x]] = 1; for(int i = 1; i <= n; ++i) for(int j = 0; j < 32; ++j) for(int j2 = 0; j2 < 5; ++j2) if(vist[j] || i % k) dp[i][j] = (dp[i][j] + dp[i - 1][j ^ (1 << j2)]) % mod; for(int i = 0; i <= 9; ++i) cout << dp[n][sticks[i]] << endl; return 0; }
#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...