| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1339467 | vjudge1 | Parametriziran (COCI19_parametriziran) | C++17 | 1008 ms | 3996 KiB |
#include <bits/stdc++.h>
#warning That's not NP, that's my NP!
using namespace std;
typedef long long ll;
const int N = 5e4, M = 6;
vector<string> group[1 << M];
signed main () {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
int on_mask = 0;
for (int j = 0; j < m; j++) {
if (s[j] != '?') {
on_mask += (1 << j);
}
}
group[on_mask].push_back(s);
}
int ans = 0;
for (int mask1 = 0; mask1 < (1 << m); mask1++) {
for (int mask2 = 0; mask2 < (1 << m); mask2++) {
map<string, int> f;
for (auto str : group[mask1]) {
string common;
for (int j = 0; j < m; j++) {
if (mask1 & (1 << j) && mask2 & (1 << j)) {
common.push_back(str[j]);
}
}
f[common]++;
}
for (auto str : group[mask2]) {
string common;
for (int j = 0; j < m; j++) {
if (mask1 & (1 << j) && mask2 & (1 << j)) {
common.push_back(str[j]);
}
}
// f[common]++;
ans += f[common];
}
}
}
cout << (ans - n) / 2 << "\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
