# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
198860 | 2020-01-27T22:15:53 Z | ZwariowanyMarcin | Parametriziran (COCI19_parametriziran) | C++14 | 177 ms | 2296 KB |
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair #define ss(x) (int) x.size() #define pb push_back #define LL long long #define ld long double #define cat(x) cerr << #x << " = " << x << endl #define FOR(i, j, n) for(int i = j; i <= n; ++i) #define boost cin.tie(0), ios_base::sync_with_stdio(0); using namespace std; const int nax = 50005; int n, m; char s[nax][10]; vector <int> v[64]; LL ans; unordered_map <int, int> x; int daj(int nr, int mask) { int y = 0; for (int i = 0; i < m; ++i) { y *= 26; if ((mask >> i) & 1) y += (s[nr][i] - 'a'); } return y; } int main() { scanf ("%d%d", &n, &m); for (int i = 0; i < n; ++i) { scanf ("%s", s[i]); int mask = 0; for (int j = 0; j < m; ++j) if (s[i][j] != '?') mask += 1 << j; v[mask].pb(i); } for (int m1 = 0; m1 < (1 << m); ++m1) for (int m2 = m1; m2 < (1 << m); ++m2) { x.clear(); int p = (m1 & m2); for (auto it : v[m1]) x[daj(it, p)]++; for (auto it : v[m2]) ans += x[daj(it, p)]; } printf ("%lld", ans - n); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 1272 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 888 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 12 ms | 1016 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 14 ms | 1272 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 1656 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 2296 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 49 ms | 1400 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 71 ms | 2244 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 120 ms | 1784 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 177 ms | 2168 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |