提出 #67789123


ソースコード 拡げる

//Yaju sempai 114 514
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep2(i, m ,n) for (int i = (m); i < (long long)(n); i++)
#define REP(i, n) for (long long i = 1; i < (long long)(n); i++)
typedef long long ll;
#define updiv(N,X) (N + X - 1) / X
#define l(n) n.begin(),n.end()
#define YesNo(Q) Q==1?cout<<"Yes":cout<<"No"
using P = pair<int, int>;
using mint = modint;
const int MOD = 998244353LL;
const ll INF = 999999999999LL;
vector<long long> fact, fact_inv, inv;
/*  init_nCk :二項係数のための前処理
    計算量:O(n)
*/
template <typename T>
void input(vector<T> &v){
 rep(i,v.size()){cin>>v[i];}
  return;
}
void init_nCk(int SIZE) {
    fact.resize(SIZE + 5);
    fact_inv.resize(SIZE + 5);
    inv.resize(SIZE + 5);
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE + 5; i++) {
        fact[i] = fact[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
}
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
long long nCk(int n, int k) {
    assert(!(n < k));
    assert(!(n < 0 || k < 0));
    return fact[n] * (fact_inv[k] * fact_inv[n - k] % MOD) % MOD;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll POW(ll a,ll n){
  long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}
int main() {
int t = 200030;
vector<mint> table(t);
//x-1
rep(i,t){table[i] = modpow(10,i,998244353LL)-1;}
vector<vector<ll>> from(t);
REP(i,t){
  from[i].push_back(i);
  for(int j = i*2;j<t;j += i){
    table[j] /= table[i];
    from[j].push_back(i);
  }
}
vector<bool> seen(t,false);
set<int> st;

int n;cin>>n;
mint res = 1;res /= 9;
rep(ittt,n){
  int a;cin>>a;
  if(!st.count(a)){
    st.insert(a);
    rep(i,from[a].size()){
      if(!seen[from[a][i]]){
        seen[from[a][i]] = true;
        res *= table[from[a][i]];
      }
    }
  }
  cout << res.val() << endl;
}
}

提出情報

提出日時
問題 C - Repunits
ユーザ Magentor
言語 C++ 17 (gcc 12.2)
得点 900
コード長 2618 Byte
結果 AC
実行時間 652 ms
メモリ 45712 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 900 / 900
結果
AC × 3
AC × 30
セット名 テストケース
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_n_small_00.txt, 01_n_small_01.txt, 01_n_small_02.txt, 01_n_small_03.txt, 01_n_small_04.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 03_hcn_00.txt, 03_hcn_01.txt, 03_hcn_02.txt, 03_hcn_03.txt, 03_hcn_04.txt, 04_max_00.txt, 05_min_00.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 226 ms 37116 KiB
00_sample_01.txt AC 240 ms 36976 KiB
00_sample_02.txt AC 222 ms 37008 KiB
01_n_small_00.txt AC 235 ms 37052 KiB
01_n_small_01.txt AC 234 ms 36948 KiB
01_n_small_02.txt AC 229 ms 36960 KiB
01_n_small_03.txt AC 239 ms 37016 KiB
01_n_small_04.txt AC 226 ms 37044 KiB
02_random_00.txt AC 485 ms 41096 KiB
02_random_01.txt AC 583 ms 42260 KiB
02_random_02.txt AC 479 ms 40928 KiB
02_random_03.txt AC 575 ms 42168 KiB
02_random_04.txt AC 587 ms 42152 KiB
02_random_05.txt AC 607 ms 42232 KiB
02_random_06.txt AC 563 ms 41680 KiB
02_random_07.txt AC 578 ms 42220 KiB
02_random_08.txt AC 450 ms 40524 KiB
02_random_09.txt AC 599 ms 42296 KiB
02_random_10.txt AC 560 ms 45708 KiB
02_random_11.txt AC 636 ms 45696 KiB
02_random_12.txt AC 636 ms 45656 KiB
02_random_13.txt AC 652 ms 45648 KiB
02_random_14.txt AC 639 ms 45712 KiB
03_hcn_00.txt AC 477 ms 36984 KiB
03_hcn_01.txt AC 494 ms 37024 KiB
03_hcn_02.txt AC 491 ms 37012 KiB
03_hcn_03.txt AC 493 ms 37112 KiB
03_hcn_04.txt AC 493 ms 37116 KiB
04_max_00.txt AC 465 ms 36984 KiB
05_min_00.txt AC 226 ms 37112 KiB