# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
135359 |
2019-07-24T04:17:42 Z |
이온조(#3249) |
PIN (CEOI10_pin) |
C++14 |
|
618 ms |
12508 KB |
#include <bits/stdc++.h>
using namespace std;
map<string, int> mp;
string S[50009];
string make(string S, int msk) {
for(int i=0; i<4; i++) if((msk >> i) & 1) S[i] = '_';
return S;
}
int main() {
cin.tie(0); cout.tie(0);
ios::sync_with_stdio(0);
int N, D; cin >> N >> D;
for(int i=1; i<=N; i++) {
cin >> S[i];
for(int j=1; j<16; j++) ++mp[make(S[i], j)];
}
for(auto& it: mp) --it.second;
long long ans = 0;
if(D == 1) {
for(int i=1; i<=N; i++) {
ans += mp[make(S[i], 1)];
ans += mp[make(S[i], 2)];
ans += mp[make(S[i], 4)];
ans += mp[make(S[i], 8)];
}
if(D == 1) return !printf("%lld", ans >> 1);
}
else {
for(int i=1; i<=N; i++) {
ans += mp[make(S[i], 3)];
ans += mp[make(S[i], 5)];
ans += mp[make(S[i], 9)];
ans += mp[make(S[i], 6)];
ans += mp[make(S[i], 10)];
ans += mp[make(S[i], 12)];
ans -= 2*mp[make(S[i], 1)];
ans -= 2*mp[make(S[i], 2)];
ans -= 2*mp[make(S[i], 4)];
ans -= 2*mp[make(S[i], 8)];
}
printf("%lld", ans >> 1);
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
2500 KB |
Output is correct |
2 |
Incorrect |
14 ms |
2424 KB |
Output isn't correct |
3 |
Incorrect |
12 ms |
2424 KB |
Output isn't correct |
4 |
Correct |
113 ms |
3452 KB |
Output is correct |
5 |
Correct |
143 ms |
3548 KB |
Output is correct |
6 |
Incorrect |
187 ms |
3464 KB |
Output isn't correct |
7 |
Incorrect |
150 ms |
3448 KB |
Output isn't correct |
8 |
Correct |
162 ms |
3596 KB |
Output is correct |
9 |
Correct |
268 ms |
3576 KB |
Output is correct |
10 |
Incorrect |
352 ms |
3724 KB |
Output isn't correct |
11 |
Incorrect |
188 ms |
3448 KB |
Output isn't correct |
12 |
Incorrect |
336 ms |
3704 KB |
Output isn't correct |
13 |
Incorrect |
223 ms |
3556 KB |
Output isn't correct |
14 |
Incorrect |
196 ms |
3588 KB |
Output isn't correct |
15 |
Incorrect |
350 ms |
3612 KB |
Output isn't correct |
16 |
Correct |
305 ms |
10204 KB |
Output is correct |
17 |
Incorrect |
618 ms |
12508 KB |
Output isn't correct |
18 |
Incorrect |
493 ms |
11036 KB |
Output isn't correct |
19 |
Incorrect |
532 ms |
12024 KB |
Output isn't correct |
20 |
Incorrect |
617 ms |
12508 KB |
Output isn't correct |