답안 #219863

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
219863 2020-04-06T15:05:33 Z mhy908 PIN (CEOI10_pin) C++14
100 / 100
50 ms 14200 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAXX=1700000;
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);
	d=4-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[1]+ans[2]+ans[3];
	printf("%d", ans[d]);
}

Compilation message

pin.cpp: In function 'int main()':
pin.cpp:30:21: warning: format '%d' expects argument of type 'int', but argument 2 has type 'LL {aka long long int}' [-Wformat=]
  printf("%d", ans[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:15: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);
                         ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 36 ms 13696 KB Output is correct
2 Correct 35 ms 13688 KB Output is correct
3 Correct 37 ms 13696 KB Output is correct
4 Correct 39 ms 13816 KB Output is correct
5 Correct 41 ms 13824 KB Output is correct
6 Correct 40 ms 13824 KB Output is correct
7 Correct 41 ms 13824 KB Output is correct
8 Correct 41 ms 13944 KB Output is correct
9 Correct 44 ms 14080 KB Output is correct
10 Correct 46 ms 14080 KB Output is correct
11 Correct 41 ms 13952 KB Output is correct
12 Correct 45 ms 14080 KB Output is correct
13 Correct 42 ms 13952 KB Output is correct
14 Correct 41 ms 13944 KB Output is correct
15 Correct 45 ms 14080 KB Output is correct
16 Correct 43 ms 13952 KB Output is correct
17 Correct 50 ms 14080 KB Output is correct
18 Correct 43 ms 13952 KB Output is correct
19 Correct 46 ms 14080 KB Output is correct
20 Correct 47 ms 14200 KB Output is correct