Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <unordered_map>
  4. #include <vector>
  5. using namespace std;
  6.  
  7. unordered_map<char, int> cm;
  8. int m[10][10][10][10];
  9. string cv = "ABCGORSVWY";
  10.  
  11. void f(string &o) {
  12.     for (int i = 0; i < 4; i++) {
  13.         m[cm[o[i % 4]]][cm[o[(i + 1) % 4]]][cm[o[(i + 2) % 4]]][cm[o[(i + 3) % 4]]]++;
  14.     }
  15. }
  16.  
  17. int main() {
  18.     for (int i = 0; i < 10; i++) {
  19.         cm[cv[i]] = i;
  20.     }
  21.     int n;
  22.     cin >> n;
  23.     for (int i = 0; i < n; i++) {
  24.         string s;
  25.         cin >> s;
  26.         string o1 = {s[0], s[1], s[3], s[2]};
  27.         string o2 = {s[0], s[5], s[3], s[4]};
  28.         string o3 = {s[5], s[1], s[4], s[2]};
  29. //        int pv = m[0][7][3][9];
  30.         f(o1);
  31.         f(o2);
  32.         f(o3);
  33. //        if (m[0][7][3][9] > pv) {
  34. //            cout << i << ' ';
  35. //        }
  36.     }
  37. //    cout << endl << "-------------" << endl;
  38.     int mh = -1;
  39.     for (int a = 0; a < 10; a++) {
  40.         for (int b = 0; b < 10; b++) {
  41.             for (int c = 0; c < 10; c++) {
  42.                 for (int d = 0; d < 10; d++) {
  43.                     if (m[a][b][c][d] > mh) {
  44.                         mh = m[a][b][c][d];
  45. //                        cout << a << ' ' << b << ' ' << c << ' ' << d << ": " << mh << " | ";
  46.                     }
  47.                 }
  48.             }
  49.         }
  50.     }
  51. //    cout << endl;
  52.     cout << mh;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement