# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
96761 | 2019-02-11T18:38:25 Z | kraljlavova1 | Parametriziran (COCI19_parametriziran) | C++11 | 2017 ms | 66560 KB |
#include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; const int MAX = 5e4 + 10, MAXOFF = 6; int n, m; ll sol; string s[MAX]; //map<string, ll> mp[1 << MAXOFF]; map<ll, ll> mp[1 << MAXOFF]; ll _hash(string x){ ll ret = 0; for(int i = 0;i < x.length(); i++){ ret += (x[i] - 'a') * (ll)pow(26, i); } return ret; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); cin >> n >> m; for(int i = 0;i < n; i++){ cin >> s[i]; } for(int i = 0;i < n; i++){ int num = 0, len = 0; string p; for(int j = 0;j < m; j++){ if(s[i][j] != '?'){ p += s[i][j]; num += (1 << j); len++; } } for(int j = 0;j < (1 << len); j++){ string tmp = p; for(int k = 0;k < len; k++){ if((1 << k) & j) tmp[k] = '?'; } sol += mp[num][_hash(tmp)]; } for(int j = 0;j < (1 << m); j++){ p = ""; for(int k = 0;k < m; k++){ if(j & (1 << k)){ p += s[i][k]; } } mp[j][_hash(p)]++; } } cout << sol << "\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 1912 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 19 ms | 1912 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 21 ms | 1912 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 61 ms | 2700 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 66 ms | 2536 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 608 ms | 10608 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 980 ms | 24140 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1870 ms | 43640 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2017 ms | 66560 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1641 ms | 66560 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |