Submission #1223652

#TimeUsernameProblemLanguageResultExecution timeMemory
1223652iulia_morariuSemafor (COI20_semafor)C++20
6 / 100
4093 ms584 KiB
#include <algorithm> #include <iostream> #include <fstream> #include <climits> #include <vector> #include <stack> #include <cmath> // #include <bits/stdc++.h> #define in cin #define out cout using namespace std; int m, n, k; int nr[10]; int ce_nr(int mask){ for(int i = 0; i <= 9; i++){ if(mask == nr[i]) return i; } return -1; } int cnt[10]; void bkt(int mask, int it){ if((it % k == 0 || it == n) && ce_nr(mask) == -1) return; // cout << "mask = " << mask << " ce = " << ce_nr(mask) << " it = " << it << '\n'; if(it == n){ cnt[ ce_nr(mask) ]++; return; } for(int b = 0; b < 5; b++){ int mask1 = ( mask ^ (1 << b) ); bkt(mask1, it + 1); } } signed main(){ ios_base::sync_with_stdio(false); in.tie(NULL); in >> m >> n >> k; int x; in >> x; // inital // pt a nr[2] += 1; nr[3] += 1; nr[5] += 1; nr[7] += 1; nr[8] += 1; nr[9] += 1; // pt b nr[1] += 2; nr[3] += 2; nr[4] += 2; nr[7] += 2; nr[9] += 2; nr[0] += 2; // pt c nr[3] += 4; nr[5] += 4; nr[6] += 4; nr[8] += 4; nr[9] += 4; // pt d nr[2] += 8; nr[6] += 8; nr[8] += 8; nr[0] += 8; // pt e nr[4] += 16; nr[5] += 16; nr[8] += 16; nr[9] += 16; // cout << "nr : "; // for(int i = 0; i <= 9; i++) cout << nr[i] << " "; // cout << '\n'; x = nr[x]; bkt(x, 0); for(int i = 0; i < 10; i++) cout << cnt[i] << '\n'; 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...