提出 #47486840


ソースコード 拡げる

/*
Author : Hocky Yudhiono
Sab 11 Nov 2023 07:03:21
*/

#include "bits/stdc++.h"
using namespace std;

typedef long long LL;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> PII;
typedef pair<int, int> pii;
typedef pair<LL, LL> PLL;
typedef pair<LL, LL> pll;
typedef long double ld;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define popf pop_front
#define pf push_front
#define popb pop_back
#define pb push_back
#define fi first
#define se second

const double EPS = 1e-9;
const int INFMEM = 63;

// Do dir^1 to get reverse direction
const int dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
const int dy[8] = {1, -1, 0, 0, 1, -1, -1, 1};
const char dch[4] = {'R', 'L', 'D', 'U'};

// Do (dir + 2)%4 to get reverse direction
// const int dx[8] = {-1,0,1,0,-1,1,1,-1};
// const int dy[8] = {0,1,0,-1,1,1,-1,-1};
// const char dch[4] = {'U','R','D','L'};
const double PI = 3.141592653589793;

inline void fasterios() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);
}
#define endl '\n'
const int MOD = 1000000007;
// const int MOD = 998244353;

int main() {
  fasterios();
  LL n; cin >> n;
  LL ans = 0;
  for (int i = 1; i <= n; i++) {
    string month = to_string(i);
    sort(all(month));
    month.erase(unique(all(month)), month.end());
    LL maxDay; cin >> maxDay;
    if (sz(month) > 1) continue;
    string tmp = "";
    assert(month[0] != '0');
    while (1) {
      tmp.pb(month[0]);
      LL day = stoll(tmp);
      if(day <= maxDay) {
        ans++;
      } else break;
    }
  }
  cout << ans << endl;
}

提出情報

提出日時
問題 B - 11/11
ユーザ hocky
言語 C++ 20 (gcc 12.2)
得点 200
コード長 1773 Byte
結果 AC
実行時間 1 ms
メモリ 3660 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 15
セット名 テストケース
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, 02_handmade_11.txt, 02_handmade_12.txt, 02_handmade_13.txt, 02_handmade_14.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3384 KiB
00_sample_01.txt AC 1 ms 3660 KiB
00_sample_02.txt AC 1 ms 3464 KiB
01_random_03.txt AC 1 ms 3656 KiB
01_random_04.txt AC 1 ms 3476 KiB
01_random_05.txt AC 1 ms 3376 KiB
01_random_06.txt AC 1 ms 3464 KiB
01_random_07.txt AC 1 ms 3528 KiB
01_random_08.txt AC 1 ms 3380 KiB
01_random_09.txt AC 1 ms 3468 KiB
01_random_10.txt AC 1 ms 3464 KiB
02_handmade_11.txt AC 1 ms 3572 KiB
02_handmade_12.txt AC 1 ms 3368 KiB
02_handmade_13.txt AC 1 ms 3340 KiB
02_handmade_14.txt AC 1 ms 3372 KiB