Submission #8827548


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;

const long long INF = 1e18;
const int N = 1e5;
const int MOD = 1e9 + 7;

const double PI = acos(-1);


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    set<string> pin;
    map<char, int> left, right;
    int n;
    string s;
    cin >> n >> s;
    left[s[0]]++;
    for (int i = 1; i < n; i++)
        right[s[i]]++;
    for (int i = 1; i < n - 1; i++) {
        right[s[i]]--;
        for (auto x : left) {
            for (auto y : right) {
                if (x.second && y.second) {
                    string t = "";
                    t.push_back(x.first);
                    t.push_back(s[i]);
                    t.push_back(y.first);
                    pin.insert(t);
                }
            }
        }
        left[s[i]]++;
    }
    cout << pin.size();
}

Submission Info

Submission Time
Task D - Lucky PIN
User axe98_
Language C++14 (GCC 5.4.1)
Score 400
Code Size 893 Byte
Status
Exec Time 942 ms
Memory 384 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt
All 400 / 400 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-corner-01.txt, 01-corner-02.txt, 01-corner-03.txt, 01-corner-04.txt, 02-random-01.txt, 02-random-02.txt, 02-random-03.txt, 02-random-04.txt, 02-random-05.txt, 02-random-06.txt, 02-random-07.txt, 03-random-x-01.txt, 03-random-x-02.txt, 03-random-x-03.txt, 04-expand-01.txt, 04-expand-02.txt, 04-expand-03.txt, 04-expand-04.txt, 04-expand-05.txt, 04-expand-06.txt, 04-expand-07.txt, 04-expand-08.txt, 05-limiting-01.txt, 05-limiting-02.txt, 05-limiting-03.txt, 05-limiting-04.txt, 05-limiting-05.txt, 05-limiting-06.txt, 05-limiting-07.txt, 05-limiting-08.txt
Case Name Status Exec Time Memory
00-sample-01.txt 1 ms 256 KB
00-sample-02.txt 1 ms 256 KB
00-sample-03.txt 1 ms 256 KB
01-corner-01.txt 1 ms 256 KB
01-corner-02.txt 1 ms 256 KB
01-corner-03.txt 1 ms 256 KB
01-corner-04.txt 1 ms 256 KB
02-random-01.txt 1 ms 256 KB
02-random-02.txt 1 ms 256 KB
02-random-03.txt 1 ms 256 KB
02-random-04.txt 2 ms 256 KB
02-random-05.txt 2 ms 384 KB
02-random-06.txt 3 ms 384 KB
02-random-07.txt 942 ms 384 KB
03-random-x-01.txt 65 ms 256 KB
03-random-x-02.txt 131 ms 256 KB
03-random-x-03.txt 342 ms 384 KB
04-expand-01.txt 7 ms 384 KB
04-expand-02.txt 14 ms 384 KB
04-expand-03.txt 73 ms 384 KB
04-expand-04.txt 124 ms 384 KB
04-expand-05.txt 244 ms 384 KB
04-expand-06.txt 454 ms 384 KB
04-expand-07.txt 482 ms 384 KB
04-expand-08.txt 709 ms 384 KB
05-limiting-01.txt 28 ms 384 KB
05-limiting-02.txt 40 ms 384 KB
05-limiting-03.txt 87 ms 384 KB
05-limiting-04.txt 209 ms 384 KB
05-limiting-05.txt 176 ms 384 KB
05-limiting-06.txt 609 ms 384 KB
05-limiting-07.txt 537 ms 384 KB
05-limiting-08.txt 701 ms 384 KB