Submission #917408

# Submission time Handle Problem Language Result Execution time Memory
917408 2024-01-28T05:41:11 Z PM1 PIN (CEOI10_pin) C++17
60 / 100
342 ms 16408 KB
#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;
	}
	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
1 Correct 7 ms 2648 KB Output is correct
2 Correct 7 ms 2652 KB Output is correct
3 Incorrect 5 ms 2412 KB Output isn't correct
4 Correct 85 ms 3920 KB Output is correct
5 Correct 88 ms 3932 KB Output is correct
6 Correct 96 ms 4136 KB Output is correct
7 Correct 72 ms 3924 KB Output is correct
8 Correct 98 ms 3860 KB Output is correct
9 Correct 154 ms 3944 KB Output is correct
10 Correct 182 ms 4176 KB Output is correct
11 Correct 112 ms 3876 KB Output is correct
12 Incorrect 164 ms 3920 KB Output isn't correct
13 Incorrect 106 ms 3896 KB Output isn't correct
14 Incorrect 94 ms 3920 KB Output isn't correct
15 Incorrect 195 ms 3912 KB Output isn't correct
16 Correct 182 ms 13252 KB Output is correct
17 Correct 319 ms 16320 KB Output is correct
18 Incorrect 201 ms 14164 KB Output isn't correct
19 Incorrect 232 ms 15304 KB Output isn't correct
20 Incorrect 342 ms 16408 KB Output isn't correct