Submission #135420

# Submission time Handle Problem Language Result Execution time Memory
135420 2019-07-24T05:10:06 Z 윤교준(#3250) PIN (CEOI10_pin) C++14
0 / 100
23 ms 13736 KB
#include <bits/stdc++.h>
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define befv(V) ((V)[sz(V)-2])
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const int MAXN = 50005;

int W[1296][4];
int D[1296][1296];

int A[MAXN];
int B[1296];

ll Ans;
int N, K;

int main() {
	for(int i = 1296; i--;) {
		for(int n = i, c = 0; c < 4; c++) {
			W[i][c] = n % 6;
			n /= 6;
		}
	}
	for(int i = 0; i < 1296; i++) for(int j = i+1; j < 1296; j++) {
		int c = 0;
		for(int k = 0; k < 4; k++) if(W[i][k] != W[j][k]) c++;
		D[i][j] = c;
	}

	scanf("%d%d", &N, &K);
	for(int i = 0; i < N; i++) {
		char str[5]; scanf(" %s", str);
		int key = 0;
		for(int j = 0; j < 4; j++) {
			key = key * 6 + (str[j] & 15) - 1;
		}
		A[i] = key;
		B[key]++;
	}

	for(int i = 0; i < 1296; i++) {
		for(int j = i+1; j < 1296; j++) {
			if(D[i][j] == K)
				Ans += ll(B[i]) * B[j];
		}
	}

	cout << Ans << endl;
	return 0;
}

Compilation message

pin.cpp: In function 'int main()':
pin.cpp:37:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &K);
  ~~~~~^~~~~~~~~~~~~~~~
pin.cpp:39:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   char str[5]; scanf(" %s", str);
                ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 6776 KB Output isn't correct
2 Incorrect 14 ms 6752 KB Output isn't correct
3 Runtime error 23 ms 13736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Incorrect 15 ms 6904 KB Output isn't correct
5 Incorrect 15 ms 6904 KB Output isn't correct
6 Incorrect 15 ms 6904 KB Output isn't correct
7 Incorrect 15 ms 6904 KB Output isn't correct
8 Incorrect 15 ms 6904 KB Output isn't correct
9 Incorrect 17 ms 7032 KB Output isn't correct
10 Incorrect 17 ms 7032 KB Output isn't correct
11 Incorrect 16 ms 6904 KB Output isn't correct
12 Incorrect 17 ms 6984 KB Output isn't correct
13 Incorrect 17 ms 6904 KB Output isn't correct
14 Incorrect 17 ms 6904 KB Output isn't correct
15 Incorrect 17 ms 6904 KB Output isn't correct
16 Incorrect 16 ms 6904 KB Output isn't correct
17 Incorrect 18 ms 7032 KB Output isn't correct
18 Incorrect 16 ms 6904 KB Output isn't correct
19 Incorrect 17 ms 6904 KB Output isn't correct
20 Incorrect 17 ms 7032 KB Output isn't correct