# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
917407 | PM1 | PIN (CEOI10_pin) | C++17 | 415 ms | 16584 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>
using namespace std;
#define ll long long
const int mxn=5e4+5;
int n,d;
string s[mxn];
map<vector<char>,int>mp[(1<<4)];
ll ans[4];
int main(){
cin>>n>>d;
for(int i=1;i<=n;i++){
cin>>s[i];
for(int j=0;j<(1<<4)-1;j++){
int cnt=0;
vector<char>v;
for(int k=0;k<4;k++){
if(j&(1<<k)){
cnt++;
v.push_back(s[i][k]);
}
}
ans[3-cnt]+=mp[j][v];
mp[j][v]++;
//cout<<j<<" "<<mp[j][v]<<endl;
}//cout<<endl;
}
for(int j=0;j<4;j++)
cout<<ans[j]<<" ";
ans[1]-=(ans[0]*3);
ans[2]-=(ans[1]*2+ans[3]*3);
ans[3]-=ans[1]+ans[2]+ans[0];
cout<<ans[d-1]<<'\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |