# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
531260 | hohohaha | PIN (CEOI10_pin) | C++14 | 157 ms | 6024 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define fori(i, a, b) for(int i = (int) (a); i <= (int) (b); i++)
#define ford(i, a, b) for(int i = (int) (a); i >= (int) (b); i--)
#define ii pair<int, int>
#define fi first
#define se second
#define vi vector<int>
#define eb emplace_back
#define sp ' '
#define int long long
const int maxn = 5e4 + 4;
int n, d;
int co[16];
string s[maxn];
signed main() {
//freopen("PIN.inp", "r", stdin);
//freopen("PIN.out", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> d;
fori(i, 1, n) cin >> s[i];
fori(mask, 0, 15) {
map<string, int> cnt;
fori(i, 1, n) {
string temp = s[i];
fori(bit, 0, 3) {
if(mask >> bit & 1) {
temp[bit] = '-';
}
}
cnt[temp]++;
}
for(auto t: cnt) {
co[mask] += t.se * (t.se - 1) / 2;
}
}
int ans = 0;
fori(mask, 0, 15) {
fori(mask2, 0, mask - 1) {
if((mask2 & mask) == mask2) {
co[mask] -= co[mask2];
}
}
if(__builtin_popcountll(mask) == d) ans += co[mask];
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |