# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
571795 |
2022-06-02T18:18:42 Z |
Blagojce |
PIN (CEOI10_pin) |
C++11 |
|
341 ms |
18460 KB |
#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define st first
#define nd second
#define all(x) begin(x), end(x)
#define pb push_back
#define all(x) begin(x), end(x)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const int mxn = 1e5+5;
const ll inf = 1e18;
const ld eps = 1e-13;
const ll mod = 1e9 + 9;
mt19937 _rand(time(0));
int n, k;
string s[mxn];
unordered_map<string, int> mapa;
ll ans = 0;
void process(int j){
fr(mask, 0, (1<<4)){
int bts = __builtin_popcount(mask);
if(bts < k) continue;
string ns = "$$$$";
fr(i, 0, 4){
if(mask&(1<<i)){
ns[i] = s[j][i];
}
}
int p = +1;
if((bts-k)%2){
p = -1;
}
ans += mapa[ns]*p;
}
fr(mask, 0, (1<<4)){
string ns = s[j];
fr(i, 0, 4){
if(mask&(1<<i)) continue;
ns[i] = '$';
}
mapa[ns] ++;
}
}
int main(){
//freopen("r.in", "r",stdin);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> k;
fr(i, 0, n){
cin >> s[i];
}
k = 4-k;
fr(i, 0, n)process(i);
if(k == 4 || k == 0){
cout<<ans<<endl;
return 0;
}
int ans2 = ans;
cout<<endl;
cout<<endl;
ans = 0;
mapa.clear();
k++;
fr(i, 0, n)process(i);
cout<<ans2-ans<<endl;
return 0;
}/*
1
3
2 3 -1*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
4052 KB |
Output is correct |
2 |
Incorrect |
8 ms |
4052 KB |
Output isn't correct |
3 |
Correct |
4 ms |
3924 KB |
Output is correct |
4 |
Correct |
72 ms |
6068 KB |
Output is correct |
5 |
Correct |
76 ms |
7076 KB |
Output is correct |
6 |
Incorrect |
108 ms |
6992 KB |
Output isn't correct |
7 |
Incorrect |
76 ms |
6144 KB |
Output isn't correct |
8 |
Correct |
80 ms |
7004 KB |
Output is correct |
9 |
Correct |
148 ms |
7984 KB |
Output is correct |
10 |
Incorrect |
199 ms |
8284 KB |
Output isn't correct |
11 |
Incorrect |
91 ms |
7004 KB |
Output isn't correct |
12 |
Incorrect |
180 ms |
8148 KB |
Output isn't correct |
13 |
Incorrect |
133 ms |
7072 KB |
Output isn't correct |
14 |
Correct |
68 ms |
7104 KB |
Output is correct |
15 |
Correct |
96 ms |
8084 KB |
Output is correct |
16 |
Correct |
193 ms |
13464 KB |
Output is correct |
17 |
Incorrect |
341 ms |
18460 KB |
Output isn't correct |
18 |
Correct |
110 ms |
14132 KB |
Output is correct |
19 |
Correct |
142 ms |
15384 KB |
Output is correct |
20 |
Correct |
209 ms |
18364 KB |
Output is correct |