結果

問題 No.2593 Reorder and Mod 120
ユーザー a01sa01to
提出日時 2025-05-10 00:42:35
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 682 bytes
コンパイル時間 3,307 ms
コンパイル使用メモリ 279,456 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-10 00:42:40
合計ジャッジ時間 4,824 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int n;
  string s;
  cin >> n >> s;
  vector<int> cnt(10, 0);
  rep(i, s.size()) cnt[s[i] - '0']++;
  set<int> st;
  rep(i, 10) rep(j, 10) rep(k, 10) {
    cnt[i]--, cnt[j]--, cnt[k]--;
    if (cnt[i] >= 0 && cnt[j] >= 0 && cnt[k] >= 0) {
      int x = i * 100 + j * 10 + k;
      st.insert(x % 40);
    }
    cnt[i]++, cnt[j]++, cnt[k]++;
  }
  cout << st.size() << '\n';
  return 0;
}
0