# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1119568 | Minbaev | PIN (CEOI10_pin) | C++17 | 315 ms | 16656 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>
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("Ofast,unroll-loops")
using namespace std;
int n,m,k,q;
map<vector<char>, int>mp[(1<<4)];
void solve(){
cin >> n >> k;
vector<string>v(n);
vector<int>ans(4);
for(auto &to:v)cin >> to;
for(int i = 0;i<n;i++){
for(int mask = 0;mask<(1<<4)-1;mask++){
int cnt = 0;
vector<char>vs;
for(int j = 0;j<4;j++){
if(mask >> j & 1){
cnt += 1;
vs.push_back(v[i][j]);
}
}
ans[3-cnt] += mp[mask][vs];
mp[mask][vs] += 1;
}
}
ans[1] -= ans[0]*3;
ans[2] -= ans[1]*2+ans[0]*3;
ans[3] -= ans[0]+ans[1]+ans[2];
cout << ans[k-1] << "\n";
}
/*
*/
signed main()
{
// freopen("seq.in", "r", stdin);
// freopen("seq.out", "w", stdout);
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int tt=1;//cin>>tt;
while(tt--)solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |