제출 #488916

#제출 시각아이디문제언어결과실행 시간메모리
488916VictorSet (COCI21_set)C++17
40 / 110
1087 ms832 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = (a); i < (b); ++i) #define per(i, a, b) for (int i = (b - 1); i >= (a); --i) #define trav(a, x) for (auto &a : x) #define all(x) x.begin(), x.end() #define sz(x) x.size() #define pb push_back #define debug(x) cout<<#x<<" = "<<x<<endl #define umap unordered_map #define uset unordered_set typedef pair<int, int> ii; typedef pair<int, ii> iii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<vi> vvi; typedef long long ll; typedef pair<ll,ll> pll; typedef vector<ll> vll; typedef vector<pll> vpll; const int INF = 1'000'000'007; int n,k,ans=0; int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); cin>>n>>k; uset<string>cards; rep(i,0,n){ string card; cin>>card; trav(card2,cards){ string goal=""; rep(i,0,k){ if(card[i]==card2[i])goal+=card[i]; else if(min(card[i],card2[i])=='1'){ if(max(card[i],card2[i])=='2')goal+='3'; else goal+='2'; } else goal+='1'; } if(cards.count(goal))++ans; } cards.insert(card); } cout<<ans/2<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...