Submission #26912134


Source Code Expand

#include <algorithm>
#include <bits/stdc++.h>
using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);

string to_string(const string &s) {
    return '"' + s + '"';
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x: v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

void debug_out() { cerr << endl;  }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++)

template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

using ll = long long;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;
//const int MOD = 998244353;



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;

  int cnt = 1;
  sort(s.begin(), s.end());
  debug(s);

  while (next_permutation(s.begin(), s.end())) {
      debug(s);
      cnt++;
  }

  cout << cnt << endl;
  //cout << ans << endl;
  //cout << fixed << setprecision(10) << ans << endl;
  return 0;
}

Submission Info

Submission Time
Task A - Distinct Strings
User rakuraruharu
Language C++ (GCC 9.2.1)
Score 100
Code Size 2044 Byte
Status AC
Exec Time 7 ms
Memory 3604 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 10
Set Name Test Cases
Sample example0.txt, example1.txt, example2.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, example0.txt, example1.txt, example2.txt
Case Name Status Exec Time Memory
000.txt AC 7 ms 3548 KiB
001.txt AC 2 ms 3552 KiB
002.txt AC 2 ms 3580 KiB
003.txt AC 2 ms 3584 KiB
004.txt AC 2 ms 3532 KiB
005.txt AC 3 ms 3532 KiB
006.txt AC 2 ms 3548 KiB
example0.txt AC 2 ms 3604 KiB
example1.txt AC 2 ms 3532 KiB
example2.txt AC 3 ms 3584 KiB