제출 #154737

#제출 시각아이디문제언어결과실행 시간메모리
154737arnold518PIN (CEOI10_pin)C++14
60 / 100
164 ms2908 KiB
#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 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++) { ans[2]+=M[A[k][4]-A[k][i]-A[k][j]]; M[A[k][4]-A[k][i]-A[k][j]]++; } } } ans[2]-=ans[1]*3; for(i=0; i<4; i++) { map<int, int> M; for(j=1; j<=N; j++) { ans[3]+=M[A[j][i]]; M[A[j][i]]++; } } ans[3]-=2*ans[2]-3*ans[1]; } 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]); }

컴파일 시 표준 에러 (stderr) 메시지

pin.cpp: In function 'void solve()':
pin.cpp:22:18: warning: unused variable 'p' [-Wunused-variable]
     int i, j, k, p, q;
                  ^
pin.cpp:22:21: warning: unused variable 'q' [-Wunused-variable]
     int i, j, k, p, q;
                     ^
pin.cpp: In function 'int main()':
pin.cpp:61:12: warning: unused variable 'j' [-Wunused-variable]
     int i, j;
            ^
pin.cpp:63:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &N, &D);
     ~~~~~^~~~~~~~~~~~~~~~
pin.cpp:67:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s", s);
         ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...