Submission #4596334


Source Code Expand

Copy
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <unordered_map>
#define MOD (1000000007l)

using namespace std;

int main(void) {
  char S[100010] = { 0 };
  long N;
  cin >> N;
  cin >> S;

/*
  cout << N << endl;
  cout << S << endl;
*/

  unordered_map<long, long> um;
  for (long i = 0; i < N; i++) {
    um[S[i]] += 1;
  }

  long ret = 1;
  for (auto it: um) {
    // cout << it.first << ": " << it.second << endl;
    ret = (ret * (it.second + 1)) % MOD;
  }

  ret -= 1;
  if (ret < 0) ret += MOD;

  cout << ret << endl;

  return 0;
}

Submission Info

Submission Time
Task A - Colorful Subsequence
User set0gut1
Language C++14 (GCC 5.4.1)
Score 200
Code Size 622 Byte
Status
Exec Time 5 ms
Memory 384 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample-01.txt, sample-02.txt, sample-03.txt
All 200 / 200 01-00.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-00.txt 5 ms 384 KB
01-01.txt 5 ms 384 KB
01-02.txt 5 ms 384 KB
01-03.txt 1 ms 384 KB
01-04.txt 1 ms 384 KB
01-05.txt 1 ms 384 KB
01-06.txt 5 ms 384 KB
01-07.txt 5 ms 384 KB
01-08.txt 5 ms 384 KB
01-09.txt 5 ms 384 KB
sample-01.txt 1 ms 384 KB
sample-02.txt 1 ms 384 KB
sample-03.txt 1 ms 384 KB