## Submission #96579

# Submission time Handle Problem Language Result Execution time Memory
96579 2019-02-10T10:52:07 Z Milki Parametriziran (COCI19_parametriziran) C++14
110 / 110
267 ms 3036 KB
```#include<bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 5e4 + 5;

int n, m;
string s[MAXN];
bitset<MAXN> bit[8][28];
bitset<MAXN> pun;

void ukloni(int x){
pun.set(x, 0);
REP(j, m){
if(s[x][j] == '?'){
REP(k, 26)
bit[j][k].set(x, 0);
}
else
bit[j][ s[x][j] - 'a' ].set(x, 0);
}
}

int main(){
ios_base::sync_with_stdio(false); cin.tie(0);

cin >> n >> m;
REP(i, n)
cin >> s[i];
REP(i, n)
pun.set(i);

REP(i, n)
REP(j, m){
if(s[i][j] == '?'){
REP(k, 26)
bit[j][k].set(i);
}
else
bit[j][ s[i][j] - 'a' ].set(i);
}

ll sol = 0;
REP(i, n){
bitset<MAXN> bits; bits.reset();

ukloni(i);

if(s[i][0] == '?')
bits |= pun;
else
bits = bit[0][ s[i][0] - 'a' ];

FOR(j, 1, m){
if(s[i][j] == '?') continue;
bits &= bit[j][ s[i][j] - 'a' ];
}
sol += bits.count();

}
cout << sol;
}
```

#### Subtask #1 11.0 / 11.0

# Verdict Execution time Memory Grader output
1 Correct 172 ms 2124 KB Output is correct

#### Subtask #2 11.0 / 11.0

# Verdict Execution time Memory Grader output
1 Correct 112 ms 2276 KB Output is correct
2 Correct 106 ms 2180 KB Output is correct

#### Subtask #3 11.0 / 11.0

# Verdict Execution time Memory Grader output
1 Correct 143 ms 2168 KB Output is correct
2 Correct 214 ms 2284 KB Output is correct

#### Subtask #4 11.0 / 11.0

# Verdict Execution time Memory Grader output
1 Correct 118 ms 2432 KB Output is correct
2 Correct 124 ms 2424 KB Output is correct

#### Subtask #5 11.0 / 11.0

# Verdict Execution time Memory Grader output
1 Correct 188 ms 2424 KB Output is correct
2 Correct 93 ms 2592 KB Output is correct

#### Subtask #6 11.0 / 11.0

# Verdict Execution time Memory Grader output
1 Correct 250 ms 2612 KB Output is correct
2 Correct 165 ms 2552 KB Output is correct

#### Subtask #7 11.0 / 11.0

# Verdict Execution time Memory Grader output
1 Correct 174 ms 2808 KB Output is correct
2 Correct 121 ms 2680 KB Output is correct

#### Subtask #8 11.0 / 11.0

# Verdict Execution time Memory Grader output
1 Correct 225 ms 2852 KB Output is correct
2 Correct 219 ms 2808 KB Output is correct

#### Subtask #9 11.0 / 11.0

# Verdict Execution time Memory Grader output
1 Correct 184 ms 3036 KB Output is correct
2 Correct 133 ms 2924 KB Output is correct

#### Subtask #10 11.0 / 11.0

# Verdict Execution time Memory Grader output
1 Correct 267 ms 2808 KB Output is correct
2 Correct 236 ms 2936 KB Output is correct