# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
598884 | 2022-07-19T07:08:40 Z | almothana05 | Cards (LMIO19_korteles) | C++14 | 742 ms | 22516 KB |
#include<bits/stdc++.h> #define mod 1000000007 using namespace std; unordered_map<int , int>links , rechts , ob , un ; unordered_map<int , int>karte, linkob , obrech , rechun , untlink ; vector<int>pow26; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); long long menge , numm , nummer , len, erg = 0 ; string s, t; for(int i = 1 ; i <= 456976 ; i *= 26){ pow26.push_back(i); } cin >> menge; for(int i = 0 ; i < menge ; i++){ cin >> s; cin >> t; for(int j = 0 ; j < t.size() ; j++){ s += t[j]; } numm = 0; numm += pow26[1] * (s[0] - 'a' ); numm += pow26[3] * (s[2] - 'a' ); erg += rechts[numm]; numm = 0; numm += pow26[0] * (s[1] - 'a' ); numm += pow26[2] * (s[3] - 'a' ); erg += links[numm]; numm = 0; numm += pow26[2] * (s[0] - 'a' ); numm += pow26[3] * (s[1] - 'a' ); erg += un[numm]; numm = 0; numm += pow26[0] * (s[2] - 'a' ); numm += pow26[1] * (s[3] - 'a' ); erg += ob[numm]; if(s[0] == s[3] && s[1] == s[2]){ numm = 0; numm += pow26[0] * (s[1] - 'a' ); numm += pow26[1] * (s[0] - 'a' ); numm += pow26[2] * (s[3] - 'a' ); numm += pow26[3] * (s[2] - 'a' ); if(karte[numm] > 0){ erg += 3; } } ///////////////////////////////////////////////////// numm = 0; numm += pow26[0] * (s[1] - 'a' ); numm += pow26[1] * (s[0] - 'a' ); numm += pow26[2] * (s[3] - 'a' ); numm += pow26[3] * (s[2] - 'a' ); erg -= karte[numm]; ///////////////////////////////++++/////////////////////////////////////////////////////////////////////////////////////// numm = 0; numm += pow26[0] * (s[2] - 'a' ); numm += pow26[1] * (s[3] - 'a'); numm += pow26[2] * (s[0] - 'a' ); numm += pow26[3] * (s[1] - 'a'); erg -= karte[numm]; ////////////////////////////////////////////////////// numm = 0; numm += pow26[2] * (s[3] - 'a' ); numm += pow26[0] * (s[1] - 'a' ); numm += pow26[0] * (s[2] - 'a' ); numm += pow26[1] * (s[3] - 'a' ); erg -= linkob[numm]; // cout << erg << "\n"; numm = 0; numm += pow26[3] * (s[2] - 'a' ); numm += pow26[1] * (s[3] - 'a' ); numm += pow26[1] * (s[0] - 'a' ); numm += pow26[0] * (s[2] - 'a' ); erg -= obrech[numm]; numm = 0; numm += pow26[2] * (s[0] - 'a' ); numm += pow26[3] * (s[2] - 'a' ); numm += pow26[3] * (s[1] - 'a' ); numm += pow26[1] * (s[0] - 'a' ); erg -= rechun[numm]; numm = 0; numm += pow26[3] * (s[1] - 'a' ); numm += pow26[2] * (s[0] - 'a' ); numm += pow26[2] * (s[3] - 'a' ); numm += pow26[0] * (s[1] - 'a' ); erg -= untlink[numm]; ////////////////////////////////////////////////////// upd numm = 0; numm += pow26[0] * (s[0] - 'a' ); numm += pow26[1] * (s[1] - 'a' ); numm += pow26[2] * (s[2] - 'a' ); numm += pow26[3] * (s[3] - 'a' ); karte[numm]++; numm = 0; numm += pow26[0] * (s[0] - 'a' ); numm += pow26[2] * (s[2] - 'a' ); links[numm]++; numm = 0; numm += pow26[1] * (s[1] - 'a' ); numm += pow26[3] * (s[3] - 'a' ); rechts[numm]++; numm = 0; numm += pow26[0] * (s[0] - 'a' ); numm += pow26[1] * (s[1] - 'a' ); ob[numm]++; numm = 0; numm += pow26[2] * (s[2] - 'a' ); numm += pow26[3] * (s[3] - 'a' ); un[numm]++; //////////////////////////////////////////////////////up3 numm = 0; numm += pow26[2] * (s[2] - 'a' ); numm += pow26[0] * (s[0] - 'a' ); numm += pow26[0] * (s[0] - 'a' ); numm += pow26[1] * (s[1] - 'a' ); linkob[numm]++; numm = 0; numm += pow26[0] * (s[0] - 'a' ); numm += pow26[1] * (s[1] - 'a' ); numm += pow26[1] * (s[1] - 'a' ); numm += pow26[3] * (s[3] - 'a' ); obrech[numm]++; numm = 0; numm += pow26[1] * (s[1] - 'a' ); numm += pow26[3] * (s[3] - 'a' ); numm += pow26[3] * (s[3] - 'a' ); numm += pow26[2] * (s[2] - 'a' ); rechun[numm]++; numm = 0; numm += pow26[3] * (s[3] - 'a' ); numm += pow26[2] * (s[2] - 'a' ); numm += pow26[2] * (s[2] - 'a' ); numm += pow26[0] * (s[0] - 'a' ); untlink[numm]++; // cout << erg << "\n"; } cout << erg<< "\n"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 1 ms | 340 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 1 ms | 340 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 742 ms | 22516 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 84 ms | 7940 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 1 ms | 340 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |