Submission #46596218


Source Code Expand

#include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...)
#endif
using int64 = long long;
using uint = unsigned int;
using uint64 = unsigned long long;
bool ckmin(auto& a, auto b) { return b < a ? a = b, 1 : 0; }
bool ckmax(auto& a, auto b) { return b > a ? a = b, 1 : 0; }
using namespace std;

const int mm = 10000000;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  string s;
  cin >> n >> s;
  vector<int> cnt0(10);
  for (int i = 0; i < n; i++) {
    cnt0[s[i] - '0']++;
  }

  int ans = 0;

  for (int x = 0; x <= mm; x++) {
    int64 t = (int64)x * x;
    vector<int> cnt(10);
    int r = 0;
    while (t) {
      cnt[t % 10]++;
      t /= 10;
      r++;
    }
    if (r < n) cnt[0] += n - r;
    if (cnt == cnt0) ans++;
  }
  cout << ans << '\n';

  return 0;
}

Submission Info

Submission Time
Task D - Square Permutation
User xindubawukong
Language C++ 20 (gcc 12.2)
Score 425
Code Size 868 Byte
Status AC
Exec Time 285 ms
Memory 3624 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 425 / 425
Status
AC × 3
AC × 46
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 02_max_23.txt, 02_max_24.txt, 02_max_25.txt, 02_max_26.txt, 02_max_27.txt, 02_max_28.txt, 02_max_29.txt, 02_max_30.txt, 02_max_31.txt, 02_max_32.txt, 02_max_33.txt, 02_max_34.txt, 02_max_35.txt, 03_small_36.txt, 03_small_37.txt, 03_small_38.txt, 03_small_39.txt, 03_small_40.txt, 03_small_41.txt, 03_small_42.txt, 03_small_43.txt, 03_small_44.txt, 03_small_45.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 281 ms 3540 KiB
00_sample_01.txt AC 279 ms 3432 KiB
00_sample_02.txt AC 281 ms 3408 KiB
01_random_03.txt AC 278 ms 3420 KiB
01_random_04.txt AC 278 ms 3428 KiB
01_random_05.txt AC 278 ms 3480 KiB
01_random_06.txt AC 279 ms 3496 KiB
01_random_07.txt AC 278 ms 3544 KiB
01_random_08.txt AC 280 ms 3492 KiB
01_random_09.txt AC 279 ms 3620 KiB
01_random_10.txt AC 278 ms 3416 KiB
01_random_11.txt AC 278 ms 3540 KiB
01_random_12.txt AC 280 ms 3492 KiB
01_random_13.txt AC 279 ms 3412 KiB
01_random_14.txt AC 279 ms 3496 KiB
01_random_15.txt AC 278 ms 3432 KiB
01_random_16.txt AC 280 ms 3496 KiB
01_random_17.txt AC 279 ms 3424 KiB
01_random_18.txt AC 279 ms 3488 KiB
01_random_19.txt AC 278 ms 3492 KiB
01_random_20.txt AC 279 ms 3432 KiB
01_random_21.txt AC 278 ms 3480 KiB
01_random_22.txt AC 280 ms 3412 KiB
02_max_23.txt AC 281 ms 3496 KiB
02_max_24.txt AC 281 ms 3348 KiB
02_max_25.txt AC 280 ms 3468 KiB
02_max_26.txt AC 280 ms 3556 KiB
02_max_27.txt AC 279 ms 3428 KiB
02_max_28.txt AC 278 ms 3428 KiB
02_max_29.txt AC 285 ms 3352 KiB
02_max_30.txt AC 279 ms 3484 KiB
02_max_31.txt AC 281 ms 3492 KiB
02_max_32.txt AC 278 ms 3548 KiB
02_max_33.txt AC 279 ms 3556 KiB
02_max_34.txt AC 280 ms 3496 KiB
02_max_35.txt AC 279 ms 3556 KiB
03_small_36.txt AC 277 ms 3380 KiB
03_small_37.txt AC 278 ms 3420 KiB
03_small_38.txt AC 279 ms 3468 KiB
03_small_39.txt AC 277 ms 3432 KiB
03_small_40.txt AC 281 ms 3436 KiB
03_small_41.txt AC 278 ms 3624 KiB
03_small_42.txt AC 280 ms 3472 KiB
03_small_43.txt AC 278 ms 3488 KiB
03_small_44.txt AC 277 ms 3488 KiB
03_small_45.txt AC 278 ms 3420 KiB