# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
778973 |
2023-07-11T05:58:08 Z |
박영우(#10003) |
PIN (CEOI10_pin) |
C++17 |
|
327 ms |
14504 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;
mul[0][0] = mul[0][2] = 1;
mul[0][1] = mul[0][3] = -1;
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
980 KB |
Output is correct |
2 |
Correct |
7 ms |
972 KB |
Output is correct |
3 |
Correct |
6 ms |
852 KB |
Output is correct |
4 |
Correct |
71 ms |
3192 KB |
Output is correct |
5 |
Correct |
90 ms |
3592 KB |
Output is correct |
6 |
Correct |
107 ms |
3620 KB |
Output is correct |
7 |
Correct |
94 ms |
3220 KB |
Output is correct |
8 |
Correct |
100 ms |
3844 KB |
Output is correct |
9 |
Correct |
162 ms |
5184 KB |
Output is correct |
10 |
Correct |
218 ms |
5580 KB |
Output is correct |
11 |
Correct |
115 ms |
3700 KB |
Output is correct |
12 |
Correct |
226 ms |
5336 KB |
Output is correct |
13 |
Correct |
139 ms |
3912 KB |
Output is correct |
14 |
Correct |
133 ms |
3708 KB |
Output is correct |
15 |
Correct |
227 ms |
5388 KB |
Output is correct |
16 |
Correct |
166 ms |
11236 KB |
Output is correct |
17 |
Correct |
298 ms |
14504 KB |
Output is correct |
18 |
Correct |
243 ms |
11980 KB |
Output is correct |
19 |
Correct |
273 ms |
13380 KB |
Output is correct |
20 |
Correct |
327 ms |
14400 KB |
Output is correct |