Submission #502080

# Submission time Handle Problem Language Result Execution time Memory
502080 2022-01-05T09:08:09 Z Marduk Cards (LMIO19_korteles) C++14
0 / 100
1000 ms 62812 KB
#include <bits/stdc++.h>
using namespace std;

#define X first
#define Y second

int n,sol;

map<pair<string,int>,int> m; //prefix, up/down, id
map<pair<string,string>,int> ob;

map<pair<string,int>,int> mf; //prefix, up/down, id
map<pair<string,string>,int> obf;

map<pair<string,string>,int> isti;

pair<string,string> Flip(string x, string y){
    return {string()+y[0]+x[0], string()+y[1]+x[1]};
}

int main(){
    cin >> n;

    for(int i = 0;i<n;i++){
        string a,b; cin >> a >> b;

        sol+=m[{a,1}]+m[{b,0}]-ob[{b,a}];
        m[{a,0}]++;
        m[{b,1}]++;
        ob[{a,b}]++;

        pair<string,string> f = Flip(a,b);
        a = f.X; b = f.Y;

        sol+=mf[{a,1}]+mf[{b,0}]-obf[{b,a}];
        mf[{a,0}]++;
        mf[{b,1}]++;
        obf[{a,b}]++;

        if(a[0]==a[1] && a[1] == b[0] && b[0] == b[1]){
            sol-=isti[{a,b}];
            isti[{a,b}]++;
        }
    }

    cout << sol;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 292 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 292 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 62812 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 320 ms 20912 KB Output is correct
3 Execution timed out 1068 ms 60072 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
2 Incorrect 0 ms 292 KB Output isn't correct
3 Halted 0 ms 0 KB -