Submission #135422

# Submission time Handle Problem Language Result Execution time Memory
135422 2019-07-24T05:18:27 Z 윤교준(#3250) PIN (CEOI10_pin) C++14
25 / 100
21 ms 7676 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;

int B[36][36][36][36];
int A[50005][4];

ll Ans;
int N, K;

ll solve1() {
	int ret = 0;
	for(int i = 0; i < N; i++) {
		int a = A[i][0], b = A[i][1], c = A[i][2], d = A[i][3];
		for(int j = 0; j < 26; j++) {
			if(j != a) ret += B[j][b][c][d];
			if(j != b) ret += B[a][j][c][d];
			if(j != c) ret += B[a][b][j][d];
			if(j != d) ret += B[a][b][c][j];
		}
	}
	return ret >> 1;
}

int main() {
	scanf("%d%d", &N, &K);
	for(int i = 0; i < N; i++) {
		char str[5]; scanf(" %s", str);
		for(int j = 0; j < 4; j++) {
			if('0' <= str[j] && str[j] <= '9')
				A[i][j] = str[j] & 15;
			else A[i][j] = str[j] - 'a' + 10;
		}
		B[A[i][0]][A[i][1]][A[i][2]][A[i][3]]++;
	}

	if(1 == K) Ans = solve1();

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

Compilation message

pin.cpp: In function 'int main()':
pin.cpp:34: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:36: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 Correct 4 ms 1656 KB Output is correct
2 Incorrect 3 ms 1656 KB Output isn't correct
3 Incorrect 3 ms 1528 KB Output isn't correct
4 Correct 9 ms 1916 KB Output is correct
5 Correct 10 ms 2040 KB Output is correct
6 Incorrect 6 ms 2040 KB Output isn't correct
7 Incorrect 5 ms 1912 KB Output isn't correct
8 Correct 10 ms 2040 KB Output is correct
9 Correct 15 ms 2424 KB Output is correct
10 Incorrect 9 ms 2424 KB Output isn't correct
11 Incorrect 6 ms 2040 KB Output isn't correct
12 Incorrect 9 ms 2296 KB Output isn't correct
13 Incorrect 7 ms 2040 KB Output isn't correct
14 Incorrect 6 ms 2040 KB Output isn't correct
15 Incorrect 9 ms 2424 KB Output isn't correct
16 Incorrect 21 ms 7376 KB Output isn't correct
17 Incorrect 14 ms 7676 KB Output isn't correct
18 Incorrect 14 ms 7520 KB Output isn't correct
19 Incorrect 14 ms 7544 KB Output isn't correct
20 Incorrect 17 ms 7672 KB Output isn't correct