# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
778970 |
2023-07-11T05:53:51 Z |
박영우(#10003) |
PIN (CEOI10_pin) |
C++17 |
|
342 ms |
14756 KB |
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define MAX 1010101
#define MAXS 22
#define INF 1000000000000000001
#define bb ' '
#define ln '\n'
#define Ln '\n'
#ifdef _MSC_VER
# include <intrin.h>
# define __builtin_popcount __popcnt
#endif
int mul[4][4];
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
mul[1][1] = mul[2][2] = mul[3][3] = 1;
mul[1][2] = -2;
mul[1][3] = 3;
mul[2][3] = -3;
int N, D;
cin >> N >> D;
D = 4 - D;
int i, j, k;
string s;
map<string, int> mp;
ll ans = 0;
for (i = 1; i <= N; i++) {
cin >> s;
for (j = 0; j < 16; j++) {
string cpy(4, '.');
for (k = 0; k < 4; k++) if (j >> k & 1) cpy[k] = s[k];
int cnt = __builtin_popcount(j);
if (cnt >= D && cnt < 4) ans += mp[cpy] * mul[D][cnt];
}
for (j = 0; j < 16; j++) {
string cpy(4, '.');
for (k = 0; k < 4; k++) if (j >> k & 1) cpy[k] = s[k];
mp[cpy]++;
}
}
cout << ans << ln;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
968 KB |
Output is correct |
2 |
Correct |
8 ms |
980 KB |
Output is correct |
3 |
Incorrect |
6 ms |
852 KB |
Output isn't correct |
4 |
Correct |
73 ms |
3272 KB |
Output is correct |
5 |
Correct |
91 ms |
3728 KB |
Output is correct |
6 |
Correct |
117 ms |
3736 KB |
Output is correct |
7 |
Correct |
96 ms |
3292 KB |
Output is correct |
8 |
Correct |
100 ms |
3976 KB |
Output is correct |
9 |
Correct |
164 ms |
5324 KB |
Output is correct |
10 |
Correct |
225 ms |
5708 KB |
Output is correct |
11 |
Correct |
115 ms |
3856 KB |
Output is correct |
12 |
Correct |
225 ms |
5376 KB |
Output is correct |
13 |
Correct |
142 ms |
4040 KB |
Output is correct |
14 |
Incorrect |
130 ms |
3852 KB |
Output isn't correct |
15 |
Incorrect |
229 ms |
5480 KB |
Output isn't correct |
16 |
Correct |
166 ms |
11164 KB |
Output is correct |
17 |
Correct |
308 ms |
14556 KB |
Output is correct |
18 |
Incorrect |
236 ms |
12184 KB |
Output isn't correct |
19 |
Incorrect |
275 ms |
13524 KB |
Output isn't correct |
20 |
Incorrect |
342 ms |
14756 KB |
Output isn't correct |