# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
136829 |
2019-07-26T10:34:44 Z |
choikiwon |
PIN (CEOI10_pin) |
C++17 |
|
378 ms |
16504 KB |
#include<bits/stdc++.h>
using namespace std;
const int maxn = 50010;
int N, D;
string pin[maxn];
int bcnt[16];
map<string, int> cnt[16];
int main() {
std::ios::sync_with_stdio(false);
for(int i = 0; i < 16; i++) {
for(int j = 0; j < 4; j++) if(i & (1 << j)) bcnt[i]++;
}
cin >> N >> D;
D = 4 - D;
for(int i = 0; i < N; i++) {
cin >> pin[i];
}
for(int i = 0; i < N; i++) {
for(int j = 0; j < 16; j++) {
string tmp;
for(int k = 0; k < 4; k++) {
if(j & (1 << k)) tmp.push_back(pin[i][k]);
else tmp.push_back(' ');
}
cnt[j][tmp]++;
}
}
int ans = 0;
for(int i = 0; i < 16; i++) {
if(bcnt[i] < D) continue;
for(auto it = cnt[i].begin(); it != cnt[i].end(); it++) {
if((bcnt[i] - D) % 2) ans -= 1LL * it->second * (it->second - 1) / 2;
else ans += 1LL * it->second * (it->second - 1) / 2;
}
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
2680 KB |
Output is correct |
2 |
Incorrect |
10 ms |
2552 KB |
Output isn't correct |
3 |
Correct |
8 ms |
2424 KB |
Output is correct |
4 |
Correct |
82 ms |
4984 KB |
Output is correct |
5 |
Correct |
105 ms |
5368 KB |
Output is correct |
6 |
Incorrect |
109 ms |
5496 KB |
Output isn't correct |
7 |
Incorrect |
100 ms |
4984 KB |
Output isn't correct |
8 |
Correct |
121 ms |
5596 KB |
Output is correct |
9 |
Correct |
193 ms |
7032 KB |
Output is correct |
10 |
Incorrect |
213 ms |
7416 KB |
Output isn't correct |
11 |
Incorrect |
116 ms |
5496 KB |
Output isn't correct |
12 |
Incorrect |
201 ms |
7232 KB |
Output isn't correct |
13 |
Incorrect |
124 ms |
5764 KB |
Output isn't correct |
14 |
Correct |
119 ms |
5624 KB |
Output is correct |
15 |
Correct |
275 ms |
7288 KB |
Output is correct |
16 |
Correct |
298 ms |
12792 KB |
Output is correct |
17 |
Incorrect |
378 ms |
16412 KB |
Output isn't correct |
18 |
Correct |
274 ms |
13912 KB |
Output is correct |
19 |
Correct |
337 ms |
15192 KB |
Output is correct |
20 |
Correct |
373 ms |
16504 KB |
Output is correct |