Submission #135357

# Submission time Handle Problem Language Result Execution time Memory
135357 2019-07-24T04:16:38 Z 임유진(#3251) PIN (CEOI10_pin) C++14
0 / 100
23 ms 888 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long lint;

const int MAXN = 50005;
const int TOTAL = 36 * 36 * 36 * 36;

char p[MAXN][5];
int cnt[TOTAL];

int tonum(char s[]) { return 36 * 36 * 36 * s[0] + 36 * 36 + s[1] + 36 * s[2] + s[3]; }

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int N, D;
	lint ans = 0ll;

	cin >> N >> D;
	for(int i = 0; i < N; i++) cin >> p[i];

	for(int i = 0; i < N; i++) for(int j = 0; j < 4; j++)
		p[i][j] = '0' <= p[i][j] && p[i][j] <= '9' ? (p[i][j] - '0') : (p[i][j] - 'a' + 10);

	if(D == 1) {
		for(int i = 0; i < N; i++) {
			char tmp[4];
			for(int j = 0; j < 4; j++) tmp[j] = p[i][j];
			for(int j = 0; j < 4; j++) {
				for(int k = 0; k < 36; k++) if(k != p[i][j]) {
					tmp[j] = k;
					ans += cnt[tonum(tmp)];
				}
				tmp[j] = p[i][j];
			}
			cnt[tonum(p[i])]++;
		}
	}

	cout << ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 504 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Incorrect 11 ms 632 KB Output isn't correct
5 Incorrect 15 ms 632 KB Output isn't correct
6 Incorrect 4 ms 504 KB Output isn't correct
7 Incorrect 4 ms 504 KB Output isn't correct
8 Incorrect 15 ms 668 KB Output isn't correct
9 Incorrect 23 ms 632 KB Output isn't correct
10 Incorrect 6 ms 632 KB Output isn't correct
11 Incorrect 4 ms 504 KB Output isn't correct
12 Incorrect 6 ms 504 KB Output isn't correct
13 Incorrect 4 ms 504 KB Output isn't correct
14 Incorrect 4 ms 504 KB Output isn't correct
15 Incorrect 6 ms 760 KB Output isn't correct
16 Incorrect 19 ms 888 KB Output isn't correct
17 Incorrect 6 ms 504 KB Output isn't correct
18 Incorrect 5 ms 504 KB Output isn't correct
19 Incorrect 5 ms 632 KB Output isn't correct
20 Incorrect 6 ms 632 KB Output isn't correct