Submission #588205

# Submission time Handle Problem Language Result Execution time Memory
588205 2022-07-02T19:05:32 Z kolo Cards (LMIO19_korteles) C++14
0 / 100
1000 ms 32900 KB
#include <bits/stdc++.h>
using namespace std;

map<string,int> mg,md,ml,mp;
set<string> se;
long long w,n;
string s;
char pg,pd,lg,ld;

bool czy_pozioma_os_symetrii(string karta){
    // string karta = ""s + pg+lg+pd+ld;
    return (karta[0] == karta[2] && karta[1]==karta[3]);
}
bool czy_pionowa_os_symetrii(string karta){
    // string karta = ""s + pg+lg+pd+ld;
    return (karta[0] == karta[1] && karta[2]==karta[3]);
}


bool symetria_osiowa(string karta){
    // string karta = ""s + pg+lg+pd+ld;
    return karta[0] == karta[3] && karta[1]==karta[2];
}
string lusterko_pionowo(string karta){
    return ""s + karta[1]+karta[0]+karta[3]+karta[2];
}
string lusterko_poziomo(string karta){
    // string karta = ""s + pg+lg+pd+ld;
    return ""s + karta[2]+karta[3]+karta[0]+karta[1];
}
string odwroc(string s){
    for(int i = 0;i < s.size()/2;i++)
        swap(s[i],s[s.size()-i-1]);
    return s;
}



int main(){
    iostream::sync_with_stdio(0);
    cin.tie(0);
    
    cin >> n;
    for(int t = 0;t < n;t++){
        cin >> lg >> pg >> ld >> pd;
        string karta = ""s + pg+lg+pd+ld;
        mg[""s + lg + pg]++;
        md[""s + ld + pd]++;
        ml[""s + lg + ld]++;
        mp[""s + pg + pd]++;
        if(czy_pozioma_os_symetrii(karta)) w--;
        if(czy_pionowa_os_symetrii(karta)) w--;
        
        if(symetria_osiowa(karta)){
            if(se.count(lusterko_pionowo(karta))) w-=3;
        } else {
            if(se.count(lusterko_pionowo(karta))) w--;
            if(se.count(lusterko_poziomo(karta))) w--;
        }
        se.insert(karta);
        //cout << "wczesniej : " << w << "\n";
    }
    //cout << "g\n";
    for(auto e : md){
        s=e.first;
        w+=e.second*mg[odwroc(s)];
        //cout << w << " : " << e.first << " : " << e.second << " : " << odwroc(s) << " : " << mg[odwroc(s)] << "\n";
    }
    //cout << "p\n";
    for(auto e : mp){
        s=e.first;
        w+=e.second*ml[odwroc(s)];
        //cout << w <<  " : " << e.first << " : " << e.second << " : " << odwroc(s) << " : " << ml[odwroc(s)] << "\n";
    }
    //cout << "odp: ";
    
    cout << w;
    
    return 0;
}

Compilation message

korteles.cpp: In function 'std::string odwroc(std::string)':
korteles.cpp:32:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(int i = 0;i < s.size()/2;i++)
      |                   ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 32900 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 95 ms 4616 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -