# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
135369 |
2019-07-24T04:25:37 Z |
임유진(#3251) |
PIN (CEOI10_pin) |
C++14 |
|
38 ms |
7084 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 * int(s[0]) + 36 * 36 * int(s[1]) + 36 * int(s[2]) + int(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)];
//if(cnt[tonum(tmp)] != 0) printf("j = %d, tonum(%d %d %d %d) = %d\n", j, tmp[0], tmp[1], tmp[2], tmp[3], tonum(tmp));
}
tmp[j] = p[i][j];
}
cnt[tonum(p[i])]++;
//printf("tonum(p[i]) = %d\n", tonum(p[i]));
//printf("ans = %lld\n", ans);
}
}
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
1660 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Correct |
17 ms |
1784 KB |
Output is correct |
5 |
Correct |
21 ms |
1784 KB |
Output is correct |
6 |
Incorrect |
4 ms |
504 KB |
Output isn't correct |
7 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
8 |
Correct |
22 ms |
1784 KB |
Output is correct |
9 |
Correct |
33 ms |
1912 KB |
Output is 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 |
632 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 |
504 KB |
Output isn't correct |
16 |
Correct |
38 ms |
7084 KB |
Output is correct |
17 |
Incorrect |
6 ms |
504 KB |
Output isn't correct |
18 |
Incorrect |
5 ms |
504 KB |
Output isn't correct |
19 |
Incorrect |
6 ms |
632 KB |
Output isn't correct |
20 |
Incorrect |
6 ms |
632 KB |
Output isn't correct |