Submission #219865

#TimeUsernameProblemLanguageResultExecution timeMemory
219865mhy908PIN (CEOI10_pin)C++14
100 / 100
49 ms13944 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAXX=1700000;
inline int ctoi(char c){
    if('0'<=c&&c<='9')return c-'0';
    return c-'a'+10;
}
int n, d;
LL arr[MAXX], ans[10];
char str[50010][5];
int main(){
	scanf("%d %d", &n, &d);
	for(int i=1; i<=n; i++)scanf("%s", str[i]+1);
	for(int mask=0; mask<15; mask++){
		memset(arr, 0, sizeof arr);
		for(int i=1; i<=n; i++){
			int tmp=0;
			for(int j=1; j<=4; j++){
                tmp*=36;
				if(mask&(1<<(j-1)))tmp+=ctoi(str[i][j]);
			}
			ans[__builtin_popcount(mask)]+=arr[tmp]++;
		}
	}
	ans[2]-=ans[3]*3;
	ans[1]-=ans[3]*3+ans[2]*2;
	ans[0]-=ans[3]+ans[2]+ans[1];
	printf("%d", ans[4-d]);
}

Compilation message (stderr)

pin.cpp: In function 'int main()':
pin.cpp:29:23: warning: format '%d' expects argument of type 'int', but argument 2 has type 'LL {aka long long int}' [-Wformat=]
  printf("%d", ans[4-d]);
               ~~~~~~~~^
pin.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &d);
  ~~~~~^~~~~~~~~~~~~~~~~
pin.cpp:14:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=n; i++)scanf("%s", str[i]+1);
                         ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...