Submission #502078

# Submission time Handle Problem Language Result Execution time Memory
502078 2022-01-05T08:56:31 Z Marduk Cards (LMIO19_korteles) C++14
0 / 100
1000 ms 39120 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}]++;

        a = Flip(a,b).X; b = Flip(a,b).Y;

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

        sol-=isti[{a,b}];
        isti[{a,b}]++;
    }

    cout << sol;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 0 ms 292 KB Output is correct
3 Incorrect 0 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 0 ms 292 KB Output is correct
3 Incorrect 0 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 39120 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Incorrect 255 ms 14348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 292 KB Output is correct
2 Correct 0 ms 292 KB Output is correct
3 Correct 0 ms 292 KB Output is correct
4 Incorrect 0 ms 332 KB Output isn't correct
5 Halted 0 ms 0 KB -