| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1339484 | vjudge1 | Parametriziran (COCI19_parametriziran) | C++20 | 955 ms | 84128 KiB |
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int nmax = 1e5 + 1;
unordered_map<int, int> mp[1 << 6][1 << 6];
int p27[6];
int32_t main() {
p27[0] = 1;
for (int i = 1; i < 6; i++) {
p27[i] = p27[i - 1] * 27;
}
int n, m, ans = 0;
cin >> n >> m;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
int msk_cur = 0;
int val = 0;
vector<int> bz;
for (int j = 0; j < m; j++) {
if (s[j] == '?') {
continue;
} else {
msk_cur += (1 << j);
val += p27[j] * (s[j] - 'a');
}
}
for (int msk = 0; msk < (1 << 6); msk++) {
if ((msk & msk_cur) == msk) {
int x = 0;
int si = 0;
for (int j = 0; j < 6; j++) {
if (msk & (1 << j)) {
x += p27[j] * (s[j] - 'a');
} else if (msk_cur & (1 << j)) {
si += (1 << j);
}
}
ans += mp[msk_cur][si][x];
}
}
for (int msk = 0; msk < (1 << 6); msk++) {
int si = 0;
int val = 0;
for (int j = 0; j < 6; j++) {
if (msk & (1 << j)) {
if (s[j] == '?') {
si += (1 << j);
} else {
val += p27[j] * (s[j] - 'a');
}
}
}
mp[msk][si][val]++;
}
}
cout << ans;
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
