QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#512287 | #9167. Coprime Array | ucup-team3877# | WA | 0ms | 3816kb | C++23 | 22.9kb | 2024-08-10 14:02:12 | 2024-08-10 14:02:16 |
Judging History
answer
//line 1 "answer.cpp"
#if !__INCLUDE_LEVEL__
#include __FILE__
int main() {
ll s, x; input(s, x);
ll so = s;
vl ans;
if (s % 2 == 1 && x % 2 == 0) {
ans.push_back(1);
s--;
}
auto p = prime_factor(x);
uniq(p);
debug(p);
vl m, r1, r2;
for (auto pi : p) {
m.push_back(pi);
ll total = s % pi;
for (int i = 1; i < pi; i++) {
ll j = smod(total - i, pi);
if (j != 0) {
r1.push_back(i);
r2.push_back(j);
break;
}
}
}
auto [a, m2] = atcoder::crt(r1, m);
auto [b, m1] = atcoder::crt(r2, m);
debug(a, b);
if (a - m1 > -pow(10, 9)) a -= m1;
if (b - m2 > -pow(10, 9)) b -= m2;
assert(m1 == m2);
debug(m, r1, r2);
debug(a, b, m1, m2);
ll dif = ((s - a - b) / m1);
a += (dif / 2) * m1;
b += (dif - dif / 2) * m1;
ans.push_back(a);
ans.push_back(b);
debug(ans);
assert(sum(ans) == so);
rep(i, sz(ans)) {
assert(ans[i] >= -pow(10, 9) && ans[i] <= pow(10, 9));
assert(gcd(ans[i], x) == 1);
}
print(sz(ans));
print(ans);
}
#else
//line 2 "/home/seekworser/.cpp_lib/competitive_library/competitive/std/std.hpp"
#include <bits/stdc++.h>
#ifndef LOCAL_TEST
#pragma GCC target ("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif // LOCAL_TEST
using namespace std;
using std::cout;
// shorten typenames
using ll = long long;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vl = vector<ll>; using vvl = vector<vl>; using vvvl = vector<vvl>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vc = vector<char>; using vvc = vector<vc>; using vvvc = vector<vvc>;
using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
using vs = vector<string>; using vvs = vector<vector<string>>; using vvvs = vector<vector<vector<string>>>;
template<typename T> vector<vector<T>> vv(int h, int w, T val = T()) { return vector(h, vector<T>(w, val)); }
template<typename T> vector<vector<vector<T>>> vvv(int h1, int h2, int h3, T val = T()) { return vector(h1, vector(h2, vector<T>(h3, val))); }
template<typename T> vector<vector<vector<vector<T>>>> vvvv(int h1, int h2, int h3, int h4, T val = T()) { return vector(h1, vector(h2, vector(h3, vector<T>(h4, val)))); }
template <class T> using priority_queue_min = priority_queue<T, vector<T>, greater<T>>;
// define CONSTANTS
constexpr double PI = 3.14159265358979323;
constexpr int INF = 100100111; constexpr ll INFL = 3300300300300300491LL;
float EPS = 1e-8; double EPSL = 1e-10;
template<typename T> bool eq(const T x, const T y) { return x == y; }
template<> bool eq<double>(const double x, const double y) { return (abs(x - y) < EPSL * x || abs(x - y) < EPSL); }
template<> bool eq<float>(const float x, const float y) { return abs(x - y) < EPS * x; }
template<typename T> bool neq(const T x, const T y) { return !(eq<T>(x, y)); }
template<typename T> bool ge(const T x, const T y) { return (eq<T>(x, y) || (x > y)); }
template<typename T> bool le(const T x, const T y) { return (eq<T>(x, y) || (x < y)); }
template<typename T> bool gt(const T x, const T y) { return !(le<T>(x, y)); }
template<typename T> bool lt(const T x, const T y) { return !(ge<T>(x, y)); }
constexpr int MODINT998244353 = 998244353;
constexpr int MODINT1000000007 = 1000000007;
// fasten io
struct Nyan { Nyan() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(18); } } nyan;
// define macros
#define all(a) (a).begin(), (a).end()
#define sz(x) ((ll)(x).size())
#define rep1(n) for(ll dummy_iter = 0LL; dummy_iter < n; ++dummy_iter) // 0,1,...,n-1
#define rep2(i, n) for(ll i = 0LL, i##_counter = 0LL; i##_counter < ll(n); ++(i##_counter), (i) = i##_counter) // i=0,1,...,n-1
#define rep3(i, s, t) for(ll i = ll(s), i##_counter = ll(s); i##_counter < ll(t); ++(i##_counter), (i) = (i##_counter)) // i=s,s+1,...,t-1
#define rep4(i, s, t, step) for(ll i##_counter = step > 0 ? ll(s) : -ll(s), i##_end = step > 0 ? ll(t) : -ll(t), i##_step = abs(step), i = ll(s); i##_counter < i##_end; i##_counter += i##_step, i = step > 0 ? i##_counter : -i##_counter) // i=s,s+step,...,<t
#define overload4(a, b, c, d, e, ...) e
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define repe(a, v) for(auto& a : (v)) // iterate over all elements in v
#define smod(n, m) ((((n) % (m)) + (m)) % (m))
#define sdiv(n, m) (((n) - smod(n, m)) / (m))
#define uniq(a) {sort(all(a)); (a).erase(unique(all(a)), (a).end());}
int Yes(bool b=true) { cout << (b ? "Yes\n" : "No\n"); return 0; };
int YES(bool b=true) { cout << (b ? "YES\n" : "NO\n"); return 0; };
int No(bool b=true) {return Yes(!b);};
int NO(bool b=true) {return YES(!b);};
template<typename T, size_t N> T max(array<T, N>& a) { return *max_element(all(a)); };
template<typename T, size_t N> T min(array<T, N>& a) { return *min_element(all(a)); };
template<typename T> T max(vector<T>& a) { return *max_element(all(a)); };
template<typename T> T min(vector<T>& a) { return *min_element(all(a)); };
template<typename T> vector<T> vec_slice(const vector<T>& a, int l, int r) { vector<T> rev; rep(i, l, r) rev.push_back(a[i]); return rev; };
template<typename T> T sum(vector<T>& a, T zero = T(0)) { T rev = zero; rep(i, sz(a)) rev += a[i]; return rev; };
template<typename T> bool in_range(const T& val, const T& s, const T& t) { return s <= val && val < t; };
template <class T> inline vector<T>& operator--(vector<T>& v) { repe(x, v) --x; return v; }
template <class T> inline vector<T>& operator++(vector<T>& v) { repe(x, v) ++x; return v; }
ll powm(ll a, ll n, ll mod=INFL) {
ll res = 1;
while (n > 0) {
if (n & 1) res = (res * a) % mod;
if (n > 1) a = (a * a) % mod;
n >>= 1;
}
return res;
}
ll sqrtll(ll x) {
assert(x >= 0);
ll rev = sqrt(x);
while(rev * rev > x) --rev;
while((rev+1) * (rev+1)<=x) ++rev;
return rev;
}
template <class T> inline bool chmax(T& M, const T& x) { if (M < x) { M = x; return true; } return false; }
template <class T> inline bool chmin(T& m, const T& x) { if (m > x) { m = x; return true; } return false; }
int digit(ll x, int d=10) { int rev=0; while (x > 0) { rev++; x /= d;}; return rev; }
/**
* @brief std.hpp
* @docs docs/std/std.md
*/
//line 3 "/home/seekworser/.cpp_lib/competitive_library/competitive/math/prime.hpp"
bool is_prime(ll n) {
using u128 = __uint128_t;
vector<u128> a_list = {2, 7, 61, 325, 9375, 28178, 450775, 9780504, 1795265022};
if (n == 1) return false;
if (n == 2) return true;
if (n % 2 == 0) return false;
ll r = 0;
ll d = n - 1;
while (!(d & 1)) {
d >>= 1;
r++;
}
ll cnt = 0;
repe(a, a_list) {
if (a >= n) continue;
u128 res = 1;
ll di = d;
while (di > 0) {
if (di & 1) res = (res * a) % n;
if (di > 1) a = (a * a) % n;
di >>= 1;
}
if (res == 1) continue;
bool valid = false;
rep(i, r) {
if (res == n - 1) valid = true;
res = (res * res) % n;
}
if (!valid) return false;
}
return true;
}
template <class T> vector<T> divisor(T n, bool sorted=true) {
vector<T> ans(0);
for (T i = 1; i <= (T)std::sqrt(n); i++) {
if (n % i == 0) {
ans.push_back(i);
if (i * i != n) ans.push_back(n / i);
}
}
if (sorted) sort(ans.begin(), ans.end());
return ans;
};
template <class T> vector<T> prime_factor(T n) {
vector<T> ans(0);
for (T i = 2; i <= (T)std::sqrt(n); i++) {
while (n % i == 0) {
ans.push_back(i);
n /= i;
}
}
if (n != 1) ans.push_back(n);
return ans;
};
template <class T> map<T, T> prime_factor_c(T n) {
map<T, T> ans;
for (T i = 2; i <= (T)std::sqrt(n); i++) {
while (n % i == 0) {
ans[i] += 1;
n /= i;
}
}
if (n != 1) ans[n] += 1;
return ans;
};
template <class T> vector<T> primes(T n) {
vector<T> ans(0);
if (n < 2) return ans;
vector<bool> is_primev(n+1, true);
is_primev.at(0) = is_primev.at(1) = false;
for (T i = 2; i <= (T)std::sqrt(n); i++) {
if (!is_primev.at(i)) continue;
for (T j = i*2; j <= n; j+=i) is_primev.at(j) = false;
}
for (T i = 2; i <= n; i++) {
if (is_primev.at(i)) ans.push_back(i);
}
return ans;
};
template <class T> vector<T> segment_seive(T s, T t) {
vector<T> ans(0);
if (t < 2 || s < 0 || s >= t) return ans;
vector<bool> is_prime_small((T)std::sqrt(t)+1, true);
vector<bool> is_prime_large(t-s, true);
for (T i = 2; i <= (T)std::sqrt(t); i++) {
if (!is_prime_small.at(i)) continue;
for (T j = i*2; j*j < t; j+=i) is_prime_small.at(j) = false;
for (T j = max(2*i, ((s+i-1)/i)*i); j < t; j+=i) is_prime_large.at(j-s) = false;
}
for (T i=0; i < t-s; i++) {
if (is_prime_large.at(i) && s+i != 1) ans.push_back(s+i);
}
return ans;
};
/**
* @brief prime.hpp
* @docs docs/math/prime.md
*/
//line 6 "/home/seekworser/.cpp_lib/competitive_library/atcoder/math.hpp"
//line 3 "/home/seekworser/.cpp_lib/competitive_library/atcoder/internal_math.hpp"
#ifdef _MSC_VER
#include <intrin.h>
#endif
namespace atcoder {
namespace internal {
// @param m `1 <= m`
// @return x mod m
constexpr long long safe_mod(long long x, long long m) {
x %= m;
if (x < 0) x += m;
return x;
}
// Fast modular multiplication by barrett reduction
// Reference: https://en.wikipedia.org/wiki/Barrett_reduction
// NOTE: reconsider after Ice Lake
struct barrett {
unsigned int _m;
unsigned long long im;
// @param m `1 <= m < 2^31`
explicit barrett(unsigned int m) : _m(m), im((unsigned long long)(-1) / m + 1) {}
// @return m
unsigned int umod() const { return _m; }
// @param a `0 <= a < m`
// @param b `0 <= b < m`
// @return `a * b % m`
unsigned int mul(unsigned int a, unsigned int b) const {
// [1] m = 1
// a = b = im = 0, so okay
// [2] m >= 2
// im = ceil(2^64 / m)
// -> im * m = 2^64 + r (0 <= r < m)
// let z = a*b = c*m + d (0 <= c, d < m)
// a*b * im = (c*m + d) * im = c*(im*m) + d*im = c*2^64 + c*r + d*im
// c*r + d*im < m * m + m * im < m * m + 2^64 + m <= 2^64 + m * (m + 1) < 2^64 * 2
// ((ab * im) >> 64) == c or c + 1
unsigned long long z = a;
z *= b;
#ifdef _MSC_VER
unsigned long long x;
_umul128(z, im, &x);
#else
unsigned long long x =
(unsigned long long)(((unsigned __int128)(z)*im) >> 64);
#endif
unsigned int v = (unsigned int)(z - x * _m);
if (_m <= v) v += _m;
return v;
}
};
// @param n `0 <= n`
// @param m `1 <= m`
// @return `(x ** n) % m`
constexpr long long pow_mod_constexpr(long long x, long long n, int m) {
if (m == 1) return 0;
unsigned int _m = (unsigned int)(m);
unsigned long long r = 1;
unsigned long long y = safe_mod(x, m);
while (n) {
if (n & 1) r = (r * y) % _m;
y = (y * y) % _m;
n >>= 1;
}
return r;
}
// Reference:
// M. Forisek and J. Jancina,
// Fast Primality Testing for Integers That Fit into a Machine Word
// @param n `0 <= n`
constexpr bool is_prime_constexpr(int n) {
if (n <= 1) return false;
if (n == 2 || n == 7 || n == 61) return true;
if (n % 2 == 0) return false;
long long d = n - 1;
while (d % 2 == 0) d /= 2;
constexpr long long bases[3] = {2, 7, 61};
for (long long a : bases) {
long long t = d;
long long y = pow_mod_constexpr(a, t, n);
while (t != n - 1 && y != 1 && y != n - 1) {
y = y * y % n;
t <<= 1;
}
if (y != n - 1 && t % 2 == 0) {
return false;
}
}
return true;
}
template <int n> constexpr bool is_prime = is_prime_constexpr(n);
// @param b `1 <= b`
// @return pair(g, x) s.t. g = gcd(a, b), xa = g (mod b), 0 <= x < b/g
constexpr std::pair<long long, long long> inv_gcd(long long a, long long b) {
a = safe_mod(a, b);
if (a == 0) return {b, 0};
// Contracts:
// [1] s - m0 * a = 0 (mod b)
// [2] t - m1 * a = 0 (mod b)
// [3] s * |m1| + t * |m0| <= b
long long s = b, t = a;
long long m0 = 0, m1 = 1;
while (t) {
long long u = s / t;
s -= t * u;
m0 -= m1 * u; // |m1 * u| <= |m1| * s <= b
// [3]:
// (s - t * u) * |m1| + t * |m0 - m1 * u|
// <= s * |m1| - t * u * |m1| + t * (|m0| + |m1| * u)
// = s * |m1| + t * |m0| <= b
auto tmp = s;
s = t;
t = tmp;
tmp = m0;
m0 = m1;
m1 = tmp;
}
// by [3]: |m0| <= b/g
// by g != b: |m0| < b/g
if (m0 < 0) m0 += b / s;
return {s, m0};
}
// Compile time primitive root
// @param m must be prime
// @return primitive root (and minimum in now)
constexpr int primitive_root_constexpr(int m) {
if (m == 2) return 1;
if (m == 167772161) return 3;
if (m == 469762049) return 3;
if (m == 754974721) return 11;
if (m == 998244353) return 3;
int divs[20] = {};
divs[0] = 2;
int cnt = 1;
int x = (m - 1) / 2;
while (x % 2 == 0) x /= 2;
for (int i = 3; (long long)(i)*i <= x; i += 2) {
if (x % i == 0) {
divs[cnt++] = i;
while (x % i == 0) {
x /= i;
}
}
}
if (x > 1) {
divs[cnt++] = x;
}
for (int g = 2;; g++) {
bool ok = true;
for (int i = 0; i < cnt; i++) {
if (pow_mod_constexpr(g, (m - 1) / divs[i], m) == 1) {
ok = false;
break;
}
}
if (ok) return g;
}
}
template <int m> constexpr int primitive_root = primitive_root_constexpr(m);
// @param n `n < 2^32`
// @param m `1 <= m < 2^32`
// @return sum_{i=0}^{n-1} floor((ai + b) / m) (mod 2^64)
unsigned long long floor_sum_unsigned(unsigned long long n,
unsigned long long m,
unsigned long long a,
unsigned long long b) {
unsigned long long ans = 0;
while (true) {
if (a >= m) {
ans += n * (n - 1) / 2 * (a / m);
a %= m;
}
if (b >= m) {
ans += n * (b / m);
b %= m;
}
unsigned long long y_max = a * n + b;
if (y_max < m) break;
// y_max < m * (n + 1)
// floor(y_max / m) <= n
n = (unsigned long long)(y_max / m);
b = (unsigned long long)(y_max % m);
std::swap(m, a);
}
return ans;
}
} // namespace internal
} // namespace atcoder
//line 8 "/home/seekworser/.cpp_lib/competitive_library/atcoder/math.hpp"
namespace atcoder {
long long pow_mod(long long x, long long n, int m) {
assert(0 <= n && 1 <= m);
if (m == 1) return 0;
internal::barrett bt((unsigned int)(m));
unsigned int r = 1, y = (unsigned int)(internal::safe_mod(x, m));
while (n) {
if (n & 1) r = bt.mul(r, y);
y = bt.mul(y, y);
n >>= 1;
}
return r;
}
long long inv_mod(long long x, long long m) {
assert(1 <= m);
auto z = internal::inv_gcd(x, m);
assert(z.first == 1);
return z.second;
}
// (rem, mod)
std::pair<long long, long long> crt(const std::vector<long long>& r,
const std::vector<long long>& m) {
assert(r.size() == m.size());
int n = int(r.size());
// Contracts: 0 <= r0 < m0
long long r0 = 0, m0 = 1;
for (int i = 0; i < n; i++) {
assert(1 <= m[i]);
long long r1 = internal::safe_mod(r[i], m[i]), m1 = m[i];
if (m0 < m1) {
std::swap(r0, r1);
std::swap(m0, m1);
}
if (m0 % m1 == 0) {
if (r0 % m1 != r1) return {0, 0};
continue;
}
// assume: m0 > m1, lcm(m0, m1) >= 2 * max(m0, m1)
// (r0, m0), (r1, m1) -> (r2, m2 = lcm(m0, m1));
// r2 % m0 = r0
// r2 % m1 = r1
// -> (r0 + x*m0) % m1 = r1
// -> x*u0*g = r1-r0 (mod u1*g) (u0*g = m0, u1*g = m1)
// -> x = (r1 - r0) / g * inv(u0) (mod u1)
// im = inv(u0) (mod u1) (0 <= im < u1)
long long g, im;
std::tie(g, im) = internal::inv_gcd(m0, m1);
long long u1 = (m1 / g);
// |r1 - r0| < (m0 + m1) <= lcm(m0, m1)
if ((r1 - r0) % g) return {0, 0};
// u1 * u1 <= m1 * m1 / g / g <= m0 * m1 / g = lcm(m0, m1)
long long x = (r1 - r0) / g % u1 * im % u1;
// |r0| + |m0 * x|
// < m0 + m0 * (u1 - 1)
// = m0 + m0 * m1 / g - m0
// = lcm(m0, m1)
r0 += x * m0;
m0 *= u1; // -> lcm(m0, m1)
if (r0 < 0) r0 += m0;
}
return {r0, m0};
}
long long floor_sum(long long n, long long m, long long a, long long b) {
assert(0 <= n && n < (1LL << 32));
assert(1 <= m && m < (1LL << 32));
unsigned long long ans = 0;
if (a < 0) {
unsigned long long a2 = internal::safe_mod(a, m);
ans -= 1ULL * n * (n - 1) / 2 * ((a2 - a) / m);
a = a2;
}
if (b < 0) {
unsigned long long b2 = internal::safe_mod(b, m);
ans -= 1ULL * n * ((b2 - b) / m);
b = b2;
}
return ans + internal::floor_sum_unsigned(n, m, a, b);
}
} // namespace atcoder
//line 3 "/home/seekworser/.cpp_lib/competitive_library/competitive/std/io.hpp"
// overload operators (prototypes)
template <class T, class U> inline istream& operator>>(istream& is, pair<T, U>& p);
template <class T> inline istream& operator>>(istream& is, vector<T>& v);
template <class T, class U> inline ostream& operator<<(ostream& os, const pair<T, U>& p);
template <class T> inline ostream& operator<<(ostream& os, const vector<T>& v);
template <typename T, typename S> ostream &operator<<(ostream &os, const map<T, S> &mp);
template <typename T> ostream &operator<<(ostream &os, const set<T> &st);
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &st);
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T> &st);
template <typename T> ostream &operator<<(ostream &os, queue<T> q);
template <typename T> ostream &operator<<(ostream &os, deque<T> q);
template <typename T> ostream &operator<<(ostream &os, stack<T> st);
template <class T, class Container, class Compare> ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq);
// overload operators
template <class T, class U> inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template <class T> inline istream& operator>>(istream& is, vector<T>& v) { repe(x, v) is >> x; return is; }
template <class T, class U> inline ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.first << " " << p.second; return os; }
template <class T> inline ostream& operator<<(ostream& os, const vector<T>& v) { rep(i, sz(v)) { os << v.at(i); if (i != sz(v) - 1) os << " "; } return os; }
template <typename T, typename S> ostream &operator<<(ostream &os, const map<T, S> &mp) { for (auto &[key, val] : mp) { os << key << ":" << val << " "; } return os; }
template <typename T> ostream &operator<<(ostream &os, const set<T> &st) { auto itr = st.begin(); for (int i = 0; i < (int)st.size(); i++) { os << *itr << (i + 1 != (int)st.size() ? " " : ""); itr++; } return os; }
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &st) { auto itr = st.begin(); for (int i = 0; i < (int)st.size(); i++) { os << *itr << (i + 1 != (int)st.size() ? " " : ""); itr++; } return os; }
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T> &st) { ll cnt = 0; for (auto &e : st) { os << e << (++cnt != (int)st.size() ? " " : ""); } return os; }
template <typename T> ostream &operator<<(ostream &os, queue<T> q) { while (q.size()) { os << q.front() << " "; q.pop(); } return os; }
template <typename T> ostream &operator<<(ostream &os, deque<T> q) { while (q.size()) { os << q.front(); q.pop_front(); if (q.size()) os << " "; } return os; }
template <typename T> ostream &operator<<(ostream &os, stack<T> st) { while (st.size()) { os << st.top() << " "; st.pop(); } return os; }
template <class T, class Container, class Compare> ostream &operator<<(ostream &os, priority_queue<T, Container, Compare> pq) { while (pq.size()) { os << pq.top() << " "; pq.pop(); } return os; }
template <typename T> int print_sep_end(string sep, string end, const T& val) { (void)sep; cout << val << end; return 0; };
template <typename T1, typename... T2> int print_sep_end(string sep, string end, const T1 &val, const T2 &...remain) {
cout << val << sep;
print_sep_end(sep, end, remain...);
return 0;
};
template <typename... T> int print(const T &...args) { print_sep_end(" ", "\n", args...); return 0; };
template <typename... T> void flush() { cout << flush; };
template <typename... T> int print_and_flush(const T &...args) { print(args...); flush(); return 0; };
#define debug(...) debug_func(0, #__VA_ARGS__, __VA_ARGS__) // debug print
template <typename T> void input(T &a) { cin >> a; };
template <typename T1, typename... T2> void input(T1&a, T2 &...b) { cin >> a; input(b...); };
#ifdef LOCAL_TEST
template <typename T> void debug_func(int i, const T name) { (void)i; (void)name; cerr << endl; }
template <typename T1, typename T2, typename... T3> void debug_func(int i, const T1 &name, const T2 &a, const T3 &...b) {
int scope = 0;
for ( ; (scope != 0 || name[i] != ',') && name[i] != '\0'; i++ ) {
cerr << name[i];
if (name[i] == '(' || name[i] == '{') scope++;
if (name[i] == ')' || name[i] == '}') scope--;
}
cerr << ":" << a << " ";
debug_func(i + 1, name, b...);
}
template <typename T1, typename T2, typename... T3> void debug_func(int i, const T1 &name, T2 &a, T3 &...b) {
int scope = 0;
for ( ; (scope != 0 || name[i] != ',') && name[i] != '\0'; i++ ) {
cerr << name[i];
if (name[i] == '(' || name[i] == '{') scope++;
if (name[i] == ')' || name[i] == '}') scope--;
}
cerr << ":" << a << " ";
debug_func(i + 1, name, b...);
}
#endif
#ifndef LOCAL_TEST
template <typename... T>
void debug_func(T &...) {}
template <typename... T>
void debug_func(const T &...) {}
#endif
/**
* @brief io.hpp
* @docs docs/std/io.md
*/
//line 54 "answer.cpp"
#endif
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3596kb
input:
9 6
output:
3 1 1 7
result:
ok Correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
14 34
output:
2 1 13
result:
ok Correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
1000000000 223092870
output:
2 371821451 628178549
result:
ok Correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
2 1000000000
output:
2 1 1
result:
ok Correct
Test #5:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
649557664 933437700
output:
2 324708671 324848993
result:
ok Correct
Test #6:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
33396678 777360870
output:
2 16628041 16768637
result:
ok Correct
Test #7:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
48205845 903124530
output:
3 1 24070531 24135313
result:
ok Correct
Test #8:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
251037078 505905400
output:
2 125335211 125701867
result:
ok Correct
Test #9:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
30022920 172746860
output:
2 14780481 15242439
result:
ok Correct
Test #10:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
63639298 808058790
output:
2 31586171 32053127
result:
ok Correct
Test #11:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
76579017 362768406
output:
3 1 36858823 39720193
result:
ok Correct
Test #12:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
40423669 121437778
output:
3 1 20209883 20213785
result:
ok Correct
Test #13:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
449277309 720915195
output:
2 224519296 224758013
result:
ok Correct
Test #14:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
81665969 919836918
output:
3 1 40806767 40859201
result:
ok Correct
Test #15:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
470578680 280387800
output:
2 235266571 235312109
result:
ok Correct
Test #16:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
58450340 803305503
output:
2 29213185 29237155
result:
ok Correct
Test #17:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
125896113 323676210
output:
3 1 62903491 62992621
result:
ok Correct
Test #18:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
381905348 434752500
output:
2 190952581 190952767
result:
ok Correct
Test #19:
score: -100
Wrong Answer
time: 0ms
memory: 3604kb
input:
78916498 653897673
output:
2 39474800 39441698
result:
wrong answer Jury's answer is better than participant's