提出 #73081839
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fix(x) fixed << setprecision(x)
#define rep(i, start, end) for (auto i = (start); (i) < (end); (i)++)
#define repe(i, start, end) for (auto i = (start); (i) <= (end); (i)++)
#define rrep(i, start, end) for (auto i = (start); (i) >= (end); (i)--)
constexpr auto PI = 3.14159265358979;
constexpr int INF = 1e+9;
constexpr long long INFL = 1e+18;
using ll = long long;
using lld = long double;
// using mint = modint1000000007;
using mint = modint998244353;
using Pair_int = pair<int, int>;
using Pair_ll = pair<ll, ll>;
template <class T>
using Graph = vector<vector<T>>;
template <class T1, class T2>
inline auto div_floor(T1 a, T2 b)
{
if (b < 0)
a *= -1, b *= -1;
if (a >= 0)
return a / b;
else
return (a + 1) / b - 1;
}
template <class T1, class T2>
inline auto div_ceil(T1 a, T2 b)
{
if (b < 0)
a *= -1, b *= -1;
if (a <= 0)
return a / b;
else
return (a - 1) / b + 1;
}
ll floor_sqrt(ll x)
{
ll y = sqrt(x);
while (y * y > x)
y--;
while ((y + 1) * (y + 1) <= x)
y++;
return y;
}
ll pow_int(ll x, ll n)
{
ll res = 1;
while (n > 0)
{
if (n & 1)
res *= x;
x *= x;
n >>= 1;
}
return res;
}
ll pow_mod(ll x, ll n, ll mod)
{
ll res = 1;
while (n > 0)
{
if (n & 1)
res = res * x % mod;
x = x * x % mod;
n >>= 1;
}
return res;
}
ll gcd(ll x, ll y)
{
if (x < y)
swap(x, y);
ll r;
while (y > 0)
{
r = x % y;
x = y;
y = r;
}
return x;
}
ll lcm(ll x, ll y) { return ll(x / gcd(x, y)) * y; }
ll nCk(ll n, ll r)
{
if (r < 0 || n < r)
return 0;
ll ans = 1;
for (ll i = 1; i <= r; i++)
{
ans *= n--;
ans /= i;
}
return ans;
}
int get_rand(int seed, int min, int max)
{
static mt19937_64 mt64(seed);
uniform_int_distribution<int> get_rand_int(min, max);
return get_rand_int(mt64);
}
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)); }
template <class T1, class T2>
inline auto mod(T1 x, T2 r) { return (x % r + r) % r; }
// ======================================== //
int main()
{
int N;
cin >> N;
vector<int> A(N);
rep(i, 0, N) cin >> A[i];
const int MAX = 200200;
vector<int> imos(MAX, 0);
rep(i, 0, N)
{
imos[0]++;
imos[A[i]]--;
}
vector<int> ans;
ll ps = 0;
ll carry_out = 0;
rep(i, 0, MAX)
{
ps += imos[i];
ll sum = ps + carry_out;
ans.push_back(sum % 10);
carry_out = sum / 10;
}
while (!ans.empty() && ans.back() == 0)
{
ans.pop_back();
}
reverse(all(ans));
for (auto &&d : ans)
{
cout << d;
}
cout << endl;
return 0;
}
提出情報
| 提出日時 |
|
| 問題 |
D - Many Repunit Sum |
| ユーザ |
Yuulis |
| 言語 |
C++23 (GCC 15.2.0) |
| 得点 |
400 |
| コード長 |
3185 Byte |
| 結果 |
AC |
| 実行時間 |
47 ms |
| メモリ |
6184 KiB |
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
400 / 400 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
0_sample_1.txt, 0_sample_2.txt, 0_sample_3.txt |
| All |
0_sample_1.txt, 0_sample_2.txt, 0_sample_3.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 2_1.txt, 2_2.txt, 2_3.txt, 2_4.txt, 2_5.txt, 2_6.txt, 2_7.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 0_sample_1.txt |
AC |
3 ms |
5296 KiB |
| 0_sample_2.txt |
AC |
3 ms |
5276 KiB |
| 0_sample_3.txt |
AC |
3 ms |
5272 KiB |
| 1_01.txt |
AC |
45 ms |
5996 KiB |
| 1_02.txt |
AC |
45 ms |
6056 KiB |
| 1_03.txt |
AC |
45 ms |
6056 KiB |
| 1_04.txt |
AC |
45 ms |
6060 KiB |
| 1_05.txt |
AC |
45 ms |
6096 KiB |
| 1_06.txt |
AC |
45 ms |
6068 KiB |
| 1_07.txt |
AC |
45 ms |
6104 KiB |
| 1_08.txt |
AC |
45 ms |
6100 KiB |
| 1_09.txt |
AC |
45 ms |
6060 KiB |
| 1_10.txt |
AC |
45 ms |
6076 KiB |
| 1_11.txt |
AC |
45 ms |
6040 KiB |
| 1_12.txt |
AC |
45 ms |
6120 KiB |
| 1_13.txt |
AC |
45 ms |
6068 KiB |
| 1_14.txt |
AC |
45 ms |
6084 KiB |
| 1_15.txt |
AC |
45 ms |
6100 KiB |
| 1_16.txt |
AC |
45 ms |
6184 KiB |
| 1_17.txt |
AC |
45 ms |
6052 KiB |
| 1_18.txt |
AC |
45 ms |
6068 KiB |
| 1_19.txt |
AC |
45 ms |
6100 KiB |
| 1_20.txt |
AC |
45 ms |
6060 KiB |
| 2_1.txt |
AC |
22 ms |
6064 KiB |
| 2_2.txt |
AC |
22 ms |
6052 KiB |
| 2_3.txt |
AC |
47 ms |
6060 KiB |
| 2_4.txt |
AC |
40 ms |
6056 KiB |
| 2_5.txt |
AC |
3 ms |
5212 KiB |
| 2_6.txt |
AC |
8 ms |
5332 KiB |
| 2_7.txt |
AC |
6 ms |
5400 KiB |