제출 #658398

#제출 시각아이디문제언어결과실행 시간메모리
658398sam571128Set (COCI21_set)C++17
10 / 110
1083 ms724 KiB
#include <bits/stdc++.h> #define fastio ios_base::sync_with_stdio(0); cin.tie(0); using namespace std; const int N = 2205; map<vector<int>,int> cnt; vector<int> cards[N]; signed main(){ fastio int n,k; cin >> n >> k; for(int i = 0; i < n; i++){ for(int j = 0; j < k; j++){ char c; cin >> c; cards[i].push_back(c-'0'-1); } cnt[cards[i]]++; } int ans = 0; for(int i = 0; i < n; i++){ cnt[cards[i]]--; for(int j = i+1; j < n; j++){ cnt[cards[j]]--; vector<int> need; for(int x = 0; x < k; x++){ if(cards[i][x]==cards[j][x]){ need.push_back(cards[i][x]); }else{ need.push_back(3-cards[i][x]-cards[j][x]); } } ans += cnt[need]; } for(int j = i+1; j < n; j++){ cnt[cards[j]]++; } } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...