# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154740 | 2019-09-24T11:26:41 Z | arnold518 | PIN (CEOI10_pin) | C++14 | 158 ms | 3064 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 5e4; int N, D; int A[MAXN+10][5], T[5]={1, 40, 40*40, 40*40*40}; ll arr[5], ans[5]; int f(char x) { if('0'<=x && x<='9') return x-'0'; else return x-'a'+10; } void solve() { int i, j, k, p, q; for(i=0; i<4; i++) { map<int, int> M; for(j=1; j<=N; j++) { ans[1]+=M[A[j][4]-A[j][i]]; M[A[j][4]-A[j][i]]++; } } for(i=0; i<4; i++) { for(j=i+1; j<4; j++) { map<int, int> M; for(k=1; k<=N; k++) { arr[2]+=M[A[k][4]-A[k][i]-A[k][j]]; M[A[k][4]-A[k][i]-A[k][j]]++; } } } for(i=0; i<4; i++) { map<int, int> M; for(j=1; j<=N; j++) { arr[3]+=M[A[j][i]]; M[A[j][i]]++; } } ans[1]=arr[1]; ans[2]=arr[2]-3*arr[1]; ans[3]=arr[3]-2*arr[2]+3*arr[1]; ans[4]=(ll)N*(N-1)/2-ans[1]-ans[2]-ans[3]; } int main() { int i, j; scanf("%d%d", &N, &D); for(i=1; i<=N; i++) { char s[5]; scanf("%s", s); A[i][0]=f(s[0])*T[0]; A[i][1]=f(s[1])*T[1]; A[i][2]=f(s[2])*T[2]; A[i][3]=f(s[3])*T[3]; A[i][4]=A[i][0]+A[i][1]+A[i][2]+A[i][3]; } solve(); printf("%lld", ans[D]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 380 KB | Output isn't correct |
2 | Incorrect | 7 ms | 376 KB | Output isn't correct |
3 | Incorrect | 5 ms | 376 KB | Output isn't correct |
4 | Incorrect | 37 ms | 1016 KB | Output isn't correct |
5 | Incorrect | 46 ms | 1156 KB | Output isn't correct |
6 | Incorrect | 45 ms | 1152 KB | Output isn't correct |
7 | Incorrect | 37 ms | 1016 KB | Output isn't correct |
8 | Incorrect | 49 ms | 1144 KB | Output isn't correct |
9 | Incorrect | 77 ms | 1644 KB | Output isn't correct |
10 | Incorrect | 84 ms | 1656 KB | Output isn't correct |
11 | Incorrect | 47 ms | 1144 KB | Output isn't correct |
12 | Incorrect | 81 ms | 1704 KB | Output isn't correct |
13 | Incorrect | 54 ms | 1276 KB | Output isn't correct |
14 | Incorrect | 49 ms | 1144 KB | Output isn't correct |
15 | Incorrect | 81 ms | 1704 KB | Output isn't correct |
16 | Incorrect | 105 ms | 2316 KB | Output isn't correct |
17 | Incorrect | 156 ms | 3048 KB | Output isn't correct |
18 | Incorrect | 118 ms | 2424 KB | Output isn't correct |
19 | Incorrect | 140 ms | 2912 KB | Output isn't correct |
20 | Incorrect | 158 ms | 3064 KB | Output isn't correct |