Submission #477348

#TimeUsernameProblemLanguageResultExecution timeMemory
477348BTheroCards (LMIO19_korteles)C++17
36 / 100
1096 ms24312 KiB
#include <bits/stdc++.h> #define pb push_back #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() using namespace std; typedef long long ll; int encode(char a, char b) { return (a - 'A') * 26 + (b - 'A'); } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<string> arr(n); vector<int> a(n), b(n), c(n), d(n); for (int i = 0; i < n; i++) { string x, y; cin >> x >> y; arr[i] = x + y; a[i] = encode(arr[i][0], arr[i][1]); b[i] = encode(arr[i][0], arr[i][2]); c[i] = encode(arr[i][1], arr[i][3]); d[i] = encode(arr[i][2], arr[i][3]); } ll ans = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < i; j++) { if (a[i] == d[j] || b[i] == c[j] || c[i] == b[j] || d[i] == a[j]) { ans++; } } } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...