제출 #1119568

#제출 시각아이디문제언어결과실행 시간메모리
1119568MinbaevPIN (CEOI10_pin)C++17
100 / 100
315 ms16656 KiB
#include <bits/stdc++.h> #pragma GCC target("avx,avx2,fma") #pragma GCC optimize("Ofast,unroll-loops") using namespace std; int n,m,k,q; map<vector<char>, int>mp[(1<<4)]; void solve(){ cin >> n >> k; vector<string>v(n); vector<int>ans(4); for(auto &to:v)cin >> to; for(int i = 0;i<n;i++){ for(int mask = 0;mask<(1<<4)-1;mask++){ int cnt = 0; vector<char>vs; for(int j = 0;j<4;j++){ if(mask >> j & 1){ cnt += 1; vs.push_back(v[i][j]); } } ans[3-cnt] += mp[mask][vs]; mp[mask][vs] += 1; } } ans[1] -= ans[0]*3; ans[2] -= ans[1]*2+ans[0]*3; ans[3] -= ans[0]+ans[1]+ans[2]; cout << ans[k-1] << "\n"; } /* */ signed main() { // freopen("seq.in", "r", stdin); // freopen("seq.out", "w", stdout); ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL); int tt=1;//cin>>tt; while(tt--)solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...