Submission #557792

# Submission time Handle Problem Language Result Execution time Memory
557792 2022-05-06T03:47:52 Z Yazan_Alattar Semafor (COI20_semafor) C++14
12 / 100
162 ms 48976 KB
#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 = 2007;
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, sticks[M], stick[M], dp[M][M];
bool vist[M];

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;

    for(int i = 0; i <= 99; ++i) stick[i] = sticks[i / 10] * 32 + sticks[i % 10];

    for(int i = 0; i <= 99; ++i) vist[stick[i]] = 1;
    // =============================

    cin >> m >> n >> k >> x;

    dp[0][stick[x]] = 1;
    for(int i = 1; i <= n; ++i)
        for(int j = 0; j < 1024; ++j)
            for(int j2 = 0; j2 < 10; ++j2)
                if(vist[j] || i % k)
                    dp[i][j] = (dp[i][j] + dp[i - 1][j ^ (1 << j2)]) % mod;

    for(int i = 0; i <= 99; ++i) cout << dp[n][stick[i]] << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 6 ms 1492 KB Output is correct
3 Correct 56 ms 12340 KB Output is correct
4 Correct 62 ms 14008 KB Output is correct
5 Correct 76 ms 14152 KB Output is correct
6 Correct 88 ms 16052 KB Output is correct
7 Correct 84 ms 18240 KB Output is correct
8 Correct 81 ms 18252 KB Output is correct
9 Correct 60 ms 13600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 162 ms 48976 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 162 ms 48976 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 6 ms 1492 KB Output is correct
3 Correct 56 ms 12340 KB Output is correct
4 Correct 62 ms 14008 KB Output is correct
5 Correct 76 ms 14152 KB Output is correct
6 Correct 88 ms 16052 KB Output is correct
7 Correct 84 ms 18240 KB Output is correct
8 Correct 81 ms 18252 KB Output is correct
9 Correct 60 ms 13600 KB Output is correct
10 Runtime error 162 ms 48976 KB Execution killed with signal 11
11 Halted 0 ms 0 KB -