# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
480212 | 2021-10-15T09:54:20 Z | mohamedsobhi777 | PIN (CEOI10_pin) | C++14 | 280 ms | 20684 KB |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; int n, d; long long ans ; string st[N] ; map<string,int> atm[17] ; int main() { ios_base::sync_with_stdio(0); cin.tie(0); #ifndef ONLINE_JUDGE #endif cin >> n >> d ; d = 4 - d; for(int i = 0 ;i < n; ++ i){ cin >> st[i] ; } for(int i = 0 ;i < n; ++ i ){ int sgn = 1; int ret = 0 ; for(int j = 1 ;j < (1<<4) ; ++ j){ int bts = __builtin_popcount(j) ; if(bts < d)continue; int sgn = (d % 2 == bts % 2 ? 1 : -1) ; string str ; for(int k = 0 ; k < 4 ; ++ k){ if(j&(1<<k)){ str += st[i][k] ; } } ret += sgn * atm[j][str]++ ; } ans += ret ; } cout << ans ; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 7116 KB | Output is correct |
2 | Incorrect | 8 ms | 7112 KB | Output isn't correct |
3 | Incorrect | 8 ms | 7076 KB | Output isn't correct |
4 | Correct | 37 ms | 9392 KB | Output is correct |
5 | Correct | 45 ms | 9668 KB | Output is correct |
6 | Incorrect | 70 ms | 9912 KB | Output isn't correct |
7 | Incorrect | 59 ms | 9420 KB | Output isn't correct |
8 | Correct | 49 ms | 9960 KB | Output is correct |
9 | Correct | 84 ms | 11264 KB | Output is correct |
10 | Incorrect | 134 ms | 11812 KB | Output isn't correct |
11 | Incorrect | 76 ms | 9924 KB | Output isn't correct |
12 | Incorrect | 145 ms | 11556 KB | Output isn't correct |
13 | Incorrect | 93 ms | 10216 KB | Output isn't correct |
14 | Incorrect | 85 ms | 10052 KB | Output isn't correct |
15 | Incorrect | 150 ms | 11664 KB | Output isn't correct |
16 | Correct | 105 ms | 16704 KB | Output is correct |
17 | Incorrect | 254 ms | 20676 KB | Output isn't correct |
18 | Incorrect | 197 ms | 18324 KB | Output isn't correct |
19 | Incorrect | 253 ms | 19844 KB | Output isn't correct |
20 | Incorrect | 280 ms | 20684 KB | Output isn't correct |