Submission #815597

# Submission time Handle Problem Language Result Execution time Memory
815597 2023-08-08T17:15:02 Z serifefedartar PIN (CEOI10_pin) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
 
#define fast ios::sync_with_stdio(0);cin.tie(0);
typedef long long ll;
#define f first
#define s second
#define MOD 1000000007
#define LOGN 20
#define MAXN 1000005
    
int temp[4], same[4];
int cnt[40][40][40][40];
int get(char ch) {
    if (ch >= '0' && ch <= '9')
        return ch-'0';
    return ch-'a'+10;
}

int main() {
    fast
    int N, D;
    vector<string> PIN(N);
    for (int i = 0; i < N; i++) {
        cin >> PIN[i];
        for (int mask = 0; mask < 16; mask++) {
            for (int plc = 0; plc < 4; plc++) {
                if ((1<<plc) & mask)
                    a[plc] = get(PIN[i][plc]);
                else
                    a[plc] = 36;
            }
            cnt[a[0]][a[1]][a[2]][a[3]]++;
        }
    }

    for (int plc1 = 0; plc1 <= 36; plc1++) {
        for (int plc2 = 0; plc2 <= 36; plc2++) {
            for (int plc3 = 0; plc3 <= 36; plc3++) {
                for (int plc4 = 0; plc4 <= 36; plc4++) {
                    int same_plc = (plc1 < 36) + (plc2 < 36) + (plc3 < 36) + (plc4 < 36);
                    fix[same_plc] += (cnt[plc1][plc2][plc3][plc4] * (cnt[plc1][plc2][plc3][plc4] - 1)) / 2; 
                } 
            }
        }
    }

    if (D == 1)
        cout << fix[3] << "\n";
    else if (D == 2)
        cout << fix[2] - 3 * fix[3] << "\n";
    else if (D == 3)
        cout << fix[1] - 2 * fix[2] + 3 * fix[3] << "\n";
    else
        cout << fix[0] - fix[1] + fix[2] - fix[3] << "\n";
}

Compilation message

pin.cpp: In function 'int main()':
pin.cpp:29:21: error: 'a' was not declared in this scope
   29 |                     a[plc] = get(PIN[i][plc]);
      |                     ^
pin.cpp:31:21: error: 'a' was not declared in this scope
   31 |                     a[plc] = 36;
      |                     ^
pin.cpp:33:17: error: 'a' was not declared in this scope
   33 |             cnt[a[0]][a[1]][a[2]][a[3]]++;
      |                 ^
pin.cpp:42:21: error: 'fix' was not declared in this scope
   42 |                     fix[same_plc] += (cnt[plc1][plc2][plc3][plc4] * (cnt[plc1][plc2][plc3][plc4] - 1)) / 2;
      |                     ^~~
pin.cpp:49:17: error: 'fix' was not declared in this scope
   49 |         cout << fix[3] << "\n";
      |                 ^~~
pin.cpp:51:17: error: 'fix' was not declared in this scope
   51 |         cout << fix[2] - 3 * fix[3] << "\n";
      |                 ^~~
pin.cpp:53:17: error: 'fix' was not declared in this scope
   53 |         cout << fix[1] - 2 * fix[2] + 3 * fix[3] << "\n";
      |                 ^~~
pin.cpp:55:17: error: 'fix' was not declared in this scope
   55 |         cout << fix[0] - fix[1] + fix[2] - fix[3] << "\n";
      |                 ^~~