# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
208404 | Atalasion | PIN (CEOI10_pin) | C++14 | 596 ms | 20888 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.
//khodaya khodet komak kon
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimise ("ofast")
#pragma GCC optimise("unroll-loops")
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int N = 200000 + 10;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000000000000000;
const ll LOG = 25;
int n, d, ted[5];
map<string, int> mp;
string s[N];
int32_t main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> d;
d = 4 - d;
for (int i = 1; i <= n; i++){
cin >> s[i];
}
for (int i = 1; i <= n; i++){
for (int mask = 1; mask < (1 << 4); mask++){
string res = "";
int cnt = 0;
for (int j = 0; j < 4; j++){
if (mask & (1 << j)) res += s[i][j], cnt++;
else res += "?";
}
// cout << res << '\n';
ted[cnt] += mp[res];
mp[res] ++;
}
}
//cout << ted[0] << ' ' << ted[1] <
ll ans = ted[d];
for (int i = d + 1; i <= 4; i++){
if ((i - d) % 2 == 1) ans -= ted[i];
else ans += ted[i];
}
cout << ans;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |