# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1024041 | kustizus | Selotejp (COCI20_selotejp) | C++17 | 37 ms | 40792 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
// freopen ("file.inp","r",stdin);
// freopen ("file.out","w",stdout);
int n, m;
cin >> n >> m;
vector<string> s(n);
vector<vector<vector<int>>> dp(n, vector<vector<int>>(m, vector<int>(1 << m, 1e9)));
for (string &x : s)
cin >> x;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
for (int mask = 0; mask < (1 << m); mask++)
if (mask & (1 << j))
{
if (s[i][j] == '.')
dp[i][j][mask] = 1e9;
else if (!j)
{
if (!i)
dp[i][j][mask] = (mask != 1 ? 1e9 : 1);
else
dp[i][j][mask] = min(dp[i - 1][m - 1][mask], dp[i - 1][m - 1][mask ^ (1 << j)] + 1);
}
else
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |