QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#674724#9515. 无限地狱cmk666100 ✓1849ms348800kbC++2316.2kb2024-10-25 17:18:552024-10-25 17:18:56

Judging History

你现在查看的是最新测评结果

  • [2024-10-25 17:18:56]
  • 评测
  • 测评结果:100
  • 用时:1849ms
  • 内存:348800kb
  • [2024-10-25 17:18:55]
  • 提交

answer

/*  _              _     _                                             _       __      __      __   
   / \     _   _  | |_  | |__     ___    _ __   _    ___   _ __ ___   | | __  / /_    / /_    / /_  
  / _ \   | | | | | __| | '_ \   / _ \  | '__| (_)  / __| | '_ ` _ \  | |/ / | '_ \  | '_ \  | '_ \ 
 / ___ \  | |_| | | |_  | | | | | (_) | | |     _  | (__  | | | | | | |   <  | (_) | | (_) | | (_) |
/_/   \_\  \__,_|  \__| |_| |_|  \___/  |_|    (_)  \___| |_| |_| |_| |_|\_\  \___/   \___/   \___/ 
[Created Time:       2024-10-25 15:20:43]
[Last Modified Time: 2024-10-25 17:18:38] */
#pragma GCC optimize("Ofast", "unroll-loops")
#include<bits/stdc++.h>
#ifdef LOCAL
#include"debug.h"
#else
#define D(...) ((void)0)
#endif
using namespace std; using ll = long long;
#define For(i, j, k) for ( int i = (j) ; i <= (k) ; i++ )
#define Fol(i, j, k) for ( int i = (j) ; i >= (k) ; i-- )
namespace FastIO
{
#define USE_FastIO
// ------------------------------
// #define DISABLE_MMAP
// ------------------------------
#if ( defined(LOCAL) || defined(_WIN32) ) && !defined(DISABLE_MMAP)
#define DISABLE_MMAP
#endif
#ifdef LOCAL
	inline void _chk_i() {}
	inline char _gc_nochk() { return getchar(); }
	inline char _gc() { return getchar(); }
	inline void _chk_o() {}
	inline void _pc_nochk(char c) { putchar(c); }
	inline void _pc(char c) { putchar(c); }
	template < int n > inline void _pnc_nochk(const char *c) { for ( int i = 0 ; i < n ; i++ ) putchar(c[i]); }
#else
#ifdef DISABLE_MMAP
	inline constexpr int _READ_SIZE = 1 << 18; inline static char _read_buffer[_READ_SIZE + 40], *_read_ptr = nullptr, *_read_ptr_end = nullptr; static inline bool _eof = false;
	inline void _chk_i() { if ( __builtin_expect(!_eof, true) && __builtin_expect(_read_ptr_end - _read_ptr < 40, false) ) { int sz = _read_ptr_end - _read_ptr; if ( sz ) memcpy(_read_buffer, _read_ptr, sz); char *beg = _read_buffer + sz; _read_ptr = _read_buffer, _read_ptr_end = beg + fread(beg, 1, _READ_SIZE, stdin); if ( __builtin_expect(_read_ptr_end != beg + _READ_SIZE, false) ) _eof = true, *_read_ptr_end = EOF; } }
	inline char _gc_nochk() { return __builtin_expect(_eof && _read_ptr == _read_ptr_end, false) ? EOF : *_read_ptr++; }
	inline char _gc() { _chk_i(); return _gc_nochk(); }
#else
#include<sys/mman.h>
#include<sys/stat.h>
	inline static char *_read_ptr = (char *)mmap(nullptr, [] { struct stat s; return fstat(0, &s), s.st_size; } (), 1, 2, 0, 0);
	inline void _chk_i() {}
	inline char _gc_nochk() { return *_read_ptr++; }
	inline char _gc() { return *_read_ptr++; }
#endif
	inline constexpr int _WRITE_SIZE = 1 << 18; inline static char _write_buffer[_WRITE_SIZE + 40], *_write_ptr = _write_buffer;
	inline void _chk_o() { if ( __builtin_expect(_write_ptr - _write_buffer > _WRITE_SIZE, false) ) fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout), _write_ptr = _write_buffer; }
	inline void _pc_nochk(char c) { *_write_ptr++ = c; }
	inline void _pc(char c) { *_write_ptr++ = c, _chk_o(); }
	template < int n > inline void _pnc_nochk(const char *c) { memcpy(_write_ptr, c, n), _write_ptr += n; }
	inline struct _auto_flush { inline ~_auto_flush() { fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout); } } _auto_flush;
#endif
#define println println_ // don't use C++23 std::println
	template < class T > inline constexpr bool _is_signed = numeric_limits < T >::is_signed;
	template < class T > inline constexpr bool _is_unsigned = numeric_limits < T >::is_integer && !_is_signed < T >;
#if __SIZEOF_LONG__ == 64
	template <> inline constexpr bool _is_signed < __int128 > = true;
	template <> inline constexpr bool _is_unsigned < __uint128_t > = true;
#endif
	inline bool _isgraph(char c) { return c >= 33; }
	inline bool _isdigit(char c) { return 48 <= c && c <= 57; } // or faster, remove c <= 57
	constexpr struct _table {
#ifndef LOCAL
	int i[65536];
#endif
	char o[40000]; constexpr _table() :
#ifndef LOCAL
	i{},
#endif
	o{} {
#ifndef LOCAL
	for ( int x = 0 ; x < 65536 ; x++ ) i[x] = -1; for ( int x = 0 ; x <= 9 ; x++ ) for ( int y = 0 ; y <= 9 ; y++ ) i[x + y * 256 + 12336] = x * 10 + y;
#endif
	for ( int x = 0 ; x < 10000 ; x++ ) for ( int y = 3, z = x ; ~y ; y-- ) o[x * 4 + y] = z % 10 + 48, z /= 10; } } _table;
	template < class T, int digit > inline constexpr T _pw10 = 10 * _pw10 < T, digit - 1 >;
	template < class T > inline constexpr T _pw10 < T, 0 > = 1;
	inline void read(char &c) { do c = _gc(); while ( !_isgraph(c) ); }
	inline void read_cstr(char *s) { char c = _gc(); while ( !_isgraph(c) ) c = _gc(); while ( _isgraph(c) ) *s++ = c, c = _gc(); *s = 0; }
	inline void read(string &s) { char c = _gc(); s.clear(); while ( !_isgraph(c) ) c = _gc(); while ( _isgraph(c) ) s.push_back(c), c = _gc(); }
	template < class T, bool neg >
#ifndef LOCAL
	__attribute__((no_sanitize("undefined")))
#endif
	inline void _read_int_suf(T &x) { _chk_i(); char c; while
#ifndef LOCAL
	( ~_table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)] ) if constexpr ( neg ) x = x * 100 - _table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)++]; else x = x * 100 + _table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)++]; if
#endif
	( _isdigit(c = _gc_nochk()) ) if constexpr ( neg ) x = x * 10 - ( c & 15 ); else x = x * 10 + ( c & 15 ); }
	template < class T, enable_if_t < _is_signed < T >, int > = 0 > inline void read(T &x) { char c; while ( !_isdigit(c = _gc()) ) if ( c == 45 ) { _read_int_suf < T, true >(x = -( _gc_nochk() & 15 )); return; } _read_int_suf < T, false >(x = c & 15); }
	template < class T, enable_if_t < _is_unsigned < T >, int > = 0 > inline void read(T &x) { char c; while ( !_isdigit(c = _gc()) ); _read_int_suf < T, false >(x = c & 15); }
	inline void write(bool x) { _pc(x | 48); }
	inline void write(char c) { _pc(c); }
	inline void write_cstr(const char *s) { while ( *s ) _pc(*s++); }
	inline void write(const string &s) { for ( char c : s ) _pc(c); }
	template < class T, bool neg, int digit > inline void _write_int_suf(T x) { if constexpr ( digit == 4 ) _pnc_nochk < 4 >(_table.o + ( neg ? -x : x ) * 4); else _write_int_suf < T, neg, digit / 2 >(x / _pw10 < T, digit / 2 >), _write_int_suf < T, neg, digit / 2 >(x % _pw10 < T, digit / 2 >); }
	template < class T, bool neg, int digit > inline void _write_int_pre(T x) { if constexpr ( digit <= 4 ) if ( digit >= 3 && ( neg ? x <= -100 : x >= 100 ) ) if ( digit >= 4 && ( neg ? x <= -1000 : x >= 1000 ) ) _pnc_nochk < 4 >(_table.o + ( neg ? -x : x ) * 4); else _pnc_nochk < 3 >(_table.o + ( neg ? -x : x ) * 4 + 1); else if ( digit >= 2 && ( neg ? x <= -10 : x >= 10 ) ) _pnc_nochk < 2 >(_table.o + ( neg ? -x : x ) * 4 + 2); else _pc_nochk(( neg ? -x : x ) | 48); else { constexpr int cur = 1 << __lg(digit - 1); if ( neg ? x <= -_pw10 < T, cur > : x >= _pw10 < T, cur > ) _write_int_pre < T, neg, digit - cur >(x / _pw10 < T, cur >), _write_int_suf < T, neg, cur >(x % _pw10 < T, cur >); else _write_int_pre < T, neg, cur >(x); } }
	template < class T, enable_if_t < _is_signed < T >, int > = 0 > inline void write(T x) { if ( x >= 0 ) _write_int_pre < T, false, numeric_limits < T >::digits10 + 1 >(x); else _pc_nochk(45), _write_int_pre < T, true, numeric_limits < T >::digits10 + 1 >(x); _chk_o(); }
	template < class T, enable_if_t < _is_unsigned < T >, int > = 0 > inline void write(T x) { _write_int_pre < T, false, numeric_limits < T >::digits10 + 1 >(x), _chk_o(); }
	template < size_t N, class ...T > inline void _read_tuple(tuple < T... > &x) { read(get < N >(x)); if constexpr ( N + 1 != sizeof...(T) ) _read_tuple < N + 1, T... >(x); }
	template < size_t N, class ...T > inline void _write_tuple(const tuple < T... > &x) { write(get < N >(x)); if constexpr ( N + 1 != sizeof...(T) ) _pc(32), _write_tuple < N + 1, T... >(x); }
	template < class ...T > inline void read(tuple < T... > &x) { _read_tuple < 0, T... >(x); }
	template < class ...T > inline void write(const tuple < T... > &x) { _write_tuple < 0, T... >(x); }
	template < class T1, class T2 > inline void read(pair < T1, T2 > &x) { read(x.first), read(x.second); }
	template < class T1, class T2 > inline void write(const pair < T1, T2 > &x) { write(x.first), _pc(32), write(x.second); }
	template < class T > inline auto read(T &x) -> decltype(x.read(), void()) { x.read(); }
	template < class T > inline auto write(const T &x) -> decltype(x.write(), void()) { x.write(); }
	template < class T1, class ...T2 > inline void read(T1 &x, T2 &...y) { read(x), read(y...); }
	template < class ...T > inline void read_cstr(char *x, T *...y) { read_cstr(x), read_cstr(y...); }
	template < class T1, class ...T2 > inline void write(const T1 &x, const T2 &...y) { write(x), write(y...); }
	template < class ...T > inline void write_cstr(const char *x, const T *...y) { write_cstr(x), write_cstr(y...); }
	template < class T > inline void print(const T &x) { write(x); }
	inline void print_cstr(const char *x) { write_cstr(x); }
	template < class T1, class ...T2 > inline void print(const T1 &x, const T2 &...y) { write(x), _pc(32), print(y...); }
	template < class ...T > inline void print_cstr(const char *x, const T *...y) { write_cstr(x), _pc(32), print_cstr(y...); }
	inline void println() { _pc(10); }
	inline void println_cstr() { _pc(10); }
	template < class ...T > inline void println(const T &...x) { print(x...), _pc(10); }
	template < class ...T > inline void println_cstr(const T *...x) { print_cstr(x...), _pc(10); }
}	using FastIO::read, FastIO::read_cstr, FastIO::write, FastIO::write_cstr, FastIO::println, FastIO::println_cstr;
template < auto P_ > class MontgomeryModInt
{
	using S = decltype(P_); static_assert(is_same_v < S, int > || is_same_v < S, long > || is_same_v < S, long long >);
	static_assert(P_ & 1 && 0 < P_ && P_ < ( (S)1 << ( sizeof(S) * 8 - 2 ) ));
	using U = conditional_t < is_same_v < S, int >, unsigned, unsigned long long >; using D = conditional_t < is_same_v < S, int >, unsigned long long, __uint128_t >;
	inline constexpr static U uinv(U x) { U y = x; for ( int i = is_same_v < S, int > ? 4 : 5 ; i-- ; ) y *= 2 - x * y; return y; }
	constexpr static U P = P_, P2 = P << 1, R = -uinv(P), R2 = -(D)P % P; static_assert(P * R == -1);
	inline constexpr static U reduce(D x) { return ( x + (U)x * R * (D)P ) >> ( sizeof(U) * 8 ); }
	inline constexpr MontgomeryModInt(U x, int) : v(x) {} U v;
public:
	inline constexpr static S mod() { return P; }
	inline constexpr MontgomeryModInt() : v(0) {}
	inline constexpr MontgomeryModInt(const MontgomeryModInt &x) : v(x.v) {}
	template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > inline constexpr MontgomeryModInt(T x) : v(reduce((D)R2 * ( numeric_limits < T >::is_signed && x < 0 ? ( ( x + P < 0 ) && ( x %= P ), x + P ) : ( ( sizeof(T) > sizeof(U) && x >= (T)1 << sizeof(U) ) && ( x %= P ), x ) ))) {}
	inline constexpr S val()const { U x = reduce(v); return ( x - P ) >> ( sizeof(U) * 8 - 1 ) ? x : x - P; }
	template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > explicit inline constexpr operator T()const { return val(); }
	inline constexpr friend bool operator==(const MontgomeryModInt &x, const MontgomeryModInt &y) { return x.val() == y.val(); }
	inline constexpr friend bool operator!=(const MontgomeryModInt &x, const MontgomeryModInt &y) { return x.val() != y.val(); }
	inline constexpr MontgomeryModInt &operator=(const MontgomeryModInt &x) & { v = x.v; return *this; }
	inline constexpr MontgomeryModInt &operator++() & { return *this += 1; }
	inline constexpr MontgomeryModInt operator++(int) & { MontgomeryModInt x = *this; *this += 1; return x; }
	inline constexpr MontgomeryModInt &operator--() & { return *this -= 1; }
	inline constexpr MontgomeryModInt operator--(int) & { MontgomeryModInt x = *this; *this -= 1; return x; }
	inline constexpr MontgomeryModInt operator-()const { return MontgomeryModInt(v ? P2 - v : 0, 0); }
	inline constexpr MontgomeryModInt &operator+=(const MontgomeryModInt &x) & { v += x.v, ( v - P2 ) >> ( sizeof(U) * 8 - 1 ) || ( v -= P2 ); return *this; }
	inline constexpr MontgomeryModInt &operator-=(const MontgomeryModInt &x) & { v -= x.v, v >> ( sizeof(U) * 8 - 1 ) && ( v += P2 ); return *this; }
	inline constexpr MontgomeryModInt &operator*=(const MontgomeryModInt &x) & { v = reduce((D)v * x.v); return *this; }
	inline constexpr MontgomeryModInt &operator/=(const MontgomeryModInt &x) & { return *this *= x.inv(); }
	inline constexpr friend MontgomeryModInt operator+(MontgomeryModInt x, const MontgomeryModInt &y) { return x += y; }
	inline constexpr friend MontgomeryModInt operator-(MontgomeryModInt x, const MontgomeryModInt &y) { return x -= y; }
	inline constexpr friend MontgomeryModInt operator*(MontgomeryModInt x, const MontgomeryModInt &y) { return x *= y; }
	inline constexpr friend MontgomeryModInt operator/(MontgomeryModInt x, const MontgomeryModInt &y) { return x /= y; }
	template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > inline constexpr MontgomeryModInt qpow(T y)const { MontgomeryModInt x = *this, z = 1; while ( y ) { if ( y & 1 ) z *= x; if ( y >>= 1 ) x *= x; } return z; }
	template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > inline constexpr friend MontgomeryModInt qpow(const MontgomeryModInt &x, T y) { return x.qpow(y); }
	inline constexpr MontgomeryModInt inv()const { return qpow(P - 2); }
	inline constexpr friend MontgomeryModInt inv(const MontgomeryModInt &x) { return x.inv(); }
	inline friend istream &operator>>(istream &is, MontgomeryModInt &x) { S y; is >> y, x = y; return is; }
	inline friend ostream &operator<<(ostream &os, const MontgomeryModInt &x) { return os << x.val(); }
#ifdef USE_FastIO
	inline void read() & { S x; ::read(x), *this = x; }
	inline void write()const { ::write(val()); }
#endif
};	using MI = MontgomeryModInt < 998244353 >; // 1000000007 1145141919810000037
constexpr int N = 1 << 21, NN = 1 << 25;
namespace PW2
{
	constexpr int M = (ll)2e10 / N; MI a[N + 1], b[M + 1];
	inline void init()
	{
		*a = 1; For(i, 1, N) a[i] = a[i - 1] * 2;
		*b = 1; For(i, 1, M) b[i] = b[i - 1] * a[N];
	}
	inline MI calc(ll x) { return x <= N ? a[x] : a[x & ( N - 1 )] * b[x >> __lg(N)]; }
}
namespace SMALL
{
	bool pr[NN + 1]; int ps[2100009], pl, mu[NN + 1], smu[NN + 1];
	MI f[N + 1], d[N + 1], g[N + 1], h[N + 1], p, q, o, oo, t;
	inline void init()
	{
		mu[1] = smu[1] = 1;
		For(i, 2, NN)
		{
			if ( !pr[i] ) ps[++pl] = i, mu[i] = -1;
			For(j, 1, pl)
			{
				if ( i * ps[j] > NN ) break; pr[i * ps[j]] = true;
				if ( i % ps[j] ) mu[i * ps[j]] = -mu[i]; else { mu[i * ps[j]] = 0; break; }
			}
			smu[i] = smu[i - 1] + mu[i];
		}
		For(i, 1, N)
		{
			f[i] += f[i - 1], d[i] += d[i - 1], t = 3 * ( f[i] + PW2::a[i - 1] ) - 2,
			p = d[i] + t, q = f[i] + f[i] + PW2::a[i] - 1, g[i] = p + p - q, h[i] = p - q;
			for ( int j = 2, l = i << 1, r = ( i + 1 ) << 1 ; l <= N ; j++, l += i, r += i + 1 )
			{
				f[l] += o = ( PW2::a[( j >> 1 ) - 1] - 1 ) * g[i] + h[i], d[l] += oo = mu[j] * t;
				if ( r <= N ) f[r] -= o, d[r] -= oo;
			}
		}
	}
}
inline MI sco(ll n) { return PW2::calc(( n - 1 ) >> 1) * ( 3 - ( n & 1 ) ) - 1 - n; }
#include<ext/pb_ds/assoc_container.hpp>
inline int smu(ll n)
{
	static __gnu_pbds::gp_hash_table < ll, int > mem;
	if ( n <= NN ) return SMALL::smu[n];
	if ( mem.find(n) != mem.end() ) return mem[n];
	int s = 1;
	for ( ll l = 2, r, o ; l <= n ; l = r + 1 ) r = n / ( o = n / l ), s -= ( r - l + 1 ) * smu(o);
	return mem[n] = s;
}
inline tuple < MI, MI, MI > calc(ll n)
{
	static __gnu_pbds::gp_hash_table < ll, tuple < MI, MI, MI > > mem;
	if ( n <= N ) return tuple(SMALL::f[n], SMALL::g[n], SMALL::h[n]);
	if ( mem.find(n) != mem.end() ) return mem[n];
	MI f = 0, p = 0, q, nw, lsco = 0, lsmu = 1;
	for ( ll l = 2, r, o ; l <= n ; l = r + 1 )
	{
		r = n / ( o = n / l ); auto [ff, gg, hh] = calc(o);
		nw = sco(r), f += ( nw - lsco ) * gg + ( r - l + 1 ) * hh, lsco = nw;
		nw = smu(r), p += ( nw - lsmu ) * ( 3 * ( ff + PW2::calc(o - 1) ) - 2 ), lsmu = nw;
	}
	p += 3 * ( f + PW2::calc(n - 1) ) - 2, q = f + f + PW2::calc(n) - 1;
	return mem[n] = tuple(f, p + p - q, p - q);
}
ll n;
int main()
{
	read(n), PW2::init(), SMALL::init();
	return println(get<0>(calc(n)) + PW2::calc(n - 1)), 0;
}
// 想上GM捏 想上GM捏 想上GM捏 想上GM捏 想上GM捏
// 伊娜可爱捏 伊娜贴贴捏

詳細信息

Subtask #1:

score: 4
Accepted

Test #1:

score: 4
Accepted
time: 513ms
memory: 347716kb

input:

6

output:

38

result:

ok 1 number(s): "38"

Test #2:

score: 4
Accepted
time: 529ms
memory: 347788kb

input:

7

output:

73

result:

ok 1 number(s): "73"

Test #3:

score: 4
Accepted
time: 504ms
memory: 347824kb

input:

8

output:

148

result:

ok 1 number(s): "148"

Test #4:

score: 4
Accepted
time: 508ms
memory: 347676kb

input:

9

output:

284

result:

ok 1 number(s): "284"

Test #5:

score: 4
Accepted
time: 508ms
memory: 348096kb

input:

10

output:

565

result:

ok 1 number(s): "565"

Subtask #2:

score: 13
Accepted

Dependency #1:

100%
Accepted

Test #6:

score: 13
Accepted
time: 536ms
memory: 347568kb

input:

30

output:

536938322

result:

ok 1 number(s): "536938322"

Test #7:

score: 13
Accepted
time: 525ms
memory: 347676kb

input:

35

output:

210046687

result:

ok 1 number(s): "210046687"

Test #8:

score: 13
Accepted
time: 518ms
memory: 347740kb

input:

38

output:

680532913

result:

ok 1 number(s): "680532913"

Test #9:

score: 13
Accepted
time: 502ms
memory: 347660kb

input:

39

output:

362030079

result:

ok 1 number(s): "362030079"

Test #10:

score: 13
Accepted
time: 498ms
memory: 347692kb

input:

40

output:

723529503

result:

ok 1 number(s): "723529503"

Subtask #3:

score: 17
Accepted

Dependency #2:

100%
Accepted

Test #11:

score: 17
Accepted
time: 519ms
memory: 347704kb

input:

2000

output:

686289840

result:

ok 1 number(s): "686289840"

Test #12:

score: 17
Accepted
time: 510ms
memory: 347656kb

input:

2500

output:

672176744

result:

ok 1 number(s): "672176744"

Test #13:

score: 17
Accepted
time: 510ms
memory: 347988kb

input:

2998

output:

77001108

result:

ok 1 number(s): "77001108"

Test #14:

score: 17
Accepted
time: 508ms
memory: 347976kb

input:

2999

output:

337824775

result:

ok 1 number(s): "337824775"

Test #15:

score: 17
Accepted
time: 522ms
memory: 347912kb

input:

3000

output:

636156660

result:

ok 1 number(s): "636156660"

Subtask #4:

score: 21
Accepted

Dependency #3:

100%
Accepted

Test #16:

score: 21
Accepted
time: 498ms
memory: 347768kb

input:

100000

output:

809175948

result:

ok 1 number(s): "809175948"

Test #17:

score: 21
Accepted
time: 526ms
memory: 347912kb

input:

200000

output:

425311829

result:

ok 1 number(s): "425311829"

Test #18:

score: 21
Accepted
time: 504ms
memory: 348100kb

input:

500000

output:

302623178

result:

ok 1 number(s): "302623178"

Test #19:

score: 21
Accepted
time: 520ms
memory: 347884kb

input:

900000

output:

683174559

result:

ok 1 number(s): "683174559"

Test #20:

score: 21
Accepted
time: 511ms
memory: 347760kb

input:

1000000

output:

126560600

result:

ok 1 number(s): "126560600"

Subtask #5:

score: 22
Accepted

Dependency #4:

100%
Accepted

Test #21:

score: 22
Accepted
time: 498ms
memory: 347716kb

input:

100000000

output:

269652149

result:

ok 1 number(s): "269652149"

Test #22:

score: 22
Accepted
time: 547ms
memory: 347872kb

input:

300000000

output:

421051808

result:

ok 1 number(s): "421051808"

Test #23:

score: 22
Accepted
time: 569ms
memory: 347748kb

input:

700000000

output:

834273337

result:

ok 1 number(s): "834273337"

Test #24:

score: 22
Accepted
time: 570ms
memory: 347920kb

input:

990000000

output:

848544380

result:

ok 1 number(s): "848544380"

Test #25:

score: 22
Accepted
time: 561ms
memory: 347924kb

input:

1000000000

output:

341773916

result:

ok 1 number(s): "341773916"

Subtask #6:

score: 23
Accepted

Dependency #5:

100%
Accepted

Test #26:

score: 23
Accepted
time: 1296ms
memory: 348024kb

input:

12000000000

output:

877921487

result:

ok 1 number(s): "877921487"

Test #27:

score: 23
Accepted
time: 1657ms
memory: 347896kb

input:

17000000000

output:

691116504

result:

ok 1 number(s): "691116504"

Test #28:

score: 23
Accepted
time: 1802ms
memory: 348800kb

input:

19900000000

output:

87007717

result:

ok 1 number(s): "87007717"

Test #29:

score: 23
Accepted
time: 1849ms
memory: 348636kb

input:

19990000000

output:

455948458

result:

ok 1 number(s): "455948458"

Test #30:

score: 23
Accepted
time: 1818ms
memory: 348636kb

input:

20000000000

output:

128153394

result:

ok 1 number(s): "128153394"