답안 #619640

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
619640 2022-08-02T13:55:58 Z samek Cards (LMIO19_korteles) C++17
36 / 100
1000 ms 2976 KB
#include <iostream>
#include <vector>

using namespace std;

int n = 0;
unsigned long long wyn = 0;
char wczytany_znak;

struct Karta {
    char L_G;
    char P_G;
    char L_D;
    char P_D;
};

vector<Karta> karty;

bool czy_mozna_ulozyc(Karta &k_1, Karta &k_2)
{
    if (k_1.P_G == k_2.L_G && k_1.P_D == k_2.L_D)
    {
        return true;
    }
    if (k_1.L_G == k_2.P_G && k_1.L_D == k_2.P_D)
    {
        return true;
    }
    if (k_1.L_G == k_2.L_D && k_1.P_G == k_2.P_D)
    {
        return true;
    }
    if (k_1.L_D == k_2.L_G && k_1.P_D == k_2.P_G)
    {
        return true;
    }
    return false;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> n;

    for (int i = 0; i < n; ++i)
    {
        karty.push_back({});
        cin >> karty[i].L_G >> karty[i].P_G >> karty[i].L_D >> karty[i].P_D;
    }

    for (int i = 0; i < n; ++i)
    {
        for (int j = i+1; j < n; ++j)
        {
            if (czy_mozna_ulozyc(karty[i],karty[j]) == true)
            {
                wyn++;
            }
        }
    }

    printf("%llu",wyn);

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 8 ms 328 KB Output is correct
8 Correct 11 ms 332 KB Output is correct
9 Correct 20 ms 364 KB Output is correct
10 Correct 13 ms 368 KB Output is correct
11 Correct 0 ms 320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1068 ms 2976 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 320 KB Output is correct
2 Execution timed out 1073 ms 980 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 8 ms 328 KB Output is correct
4 Correct 11 ms 332 KB Output is correct
5 Correct 20 ms 364 KB Output is correct
6 Correct 13 ms 368 KB Output is correct
7 Correct 0 ms 320 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 316 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Execution timed out 1068 ms 2976 KB Time limit exceeded
13 Halted 0 ms 0 KB -