답안 #480213

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
480213 2021-10-15T09:55:46 Z mohamedsobhi777 PIN (CEOI10_pin) C++14
30 / 100
280 ms 20696 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 7;
int n, d; 
long long ans ; 
string st[N] ; 
map<string,long long> 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 ){
              long long 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 += 1ll * sgn * atm[j][str]++ ; 
              }
              ans += ret ; 
       }
       cout << ans ; 
       return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 7116 KB Output is correct
2 Incorrect 8 ms 7116 KB Output isn't correct
3 Incorrect 7 ms 7116 KB Output isn't correct
4 Correct 38 ms 9296 KB Output is correct
5 Correct 50 ms 9692 KB Output is correct
6 Incorrect 74 ms 9800 KB Output isn't correct
7 Incorrect 59 ms 9508 KB Output isn't correct
8 Correct 51 ms 9952 KB Output is correct
9 Correct 83 ms 11204 KB Output is correct
10 Incorrect 147 ms 11812 KB Output isn't correct
11 Incorrect 85 ms 10028 KB Output isn't correct
12 Incorrect 157 ms 11512 KB Output isn't correct
13 Incorrect 91 ms 10252 KB Output isn't correct
14 Incorrect 88 ms 10084 KB Output isn't correct
15 Incorrect 155 ms 11676 KB Output isn't correct
16 Correct 110 ms 16692 KB Output is correct
17 Incorrect 257 ms 20676 KB Output isn't correct
18 Incorrect 236 ms 18448 KB Output isn't correct
19 Incorrect 238 ms 19660 KB Output isn't correct
20 Incorrect 280 ms 20696 KB Output isn't correct