# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
208398 | amoo_safar | PIN (CEOI10_pin) | C++14 | 267 ms | 4600 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'
using namespace std;
typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
const ll Mod = 1000000007LL;
const int N = 5e4 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;
map<str, int> mp;
str s[N];
int cnt[5];
int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, d;
cin >> n >> d;
for(int i = 1; i <= n; i++) cin >> s[i];
str t;
for(int mk = 0; mk < 15; mk++){
mp.clear();
for(int i = 1; i <= n; i++){
t = "";
for(int j = 0; j < 4; j++){
if(mk >> j & 1) t += s[i][j];
else t += '?';
}
cnt[__builtin_popcount(mk)] += mp[t];
mp[t] ++;
}
}
cnt[2] -= cnt[3] * 3;
cnt[1] -= cnt[3] * 3;
cnt[1] -= cnt[2] * 2;
cnt[0] -= cnt[1] + cnt[2] + cnt[3];
cout << cnt[4 - d] << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |