提出 #69336866


ソースコード 拡げる

// #pragma GCC optimize("O3,unroll-loops")

#include <bits/extc++.h>

using namespace std;
using namespace __gnu_pbds;

// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

__gnu_cxx::sfmt19937 mt((uint32_t) chrono::steady_clock::now().time_since_epoch().count());

template<typename T>
class vt : public std::vector<T> {
public:
    using std::vector<T>::vector;	  
    using std::vector<T>::push_back;   

    template<class U, class = decltype(std::begin(std::declval<U>()))>
    typename std::enable_if<!std::is_same<U, std::string>::value>::type
    push_back(const U& v) {
        for (auto&& i : v) this->push_back(i);
    }

    template<typename... Args>
    void push_back(Args&&... args) {
        (this->std::vector<T>::push_back(std::forward<Args>(args)), ...);
    }

    template<class arg>
    vt<T> &operator+=(arg&& val) { this->push_back(std::forward<arg>(val)); return *this; }

    vt<T> &sort(int reverse = 0) {
        if (!reverse) std::sort(this->begin(), this->end());
        else std::sort(this->rbegin(), this->rend());
        return *this;
    }

    template<class Comp>
    vt<T>& sort(Comp comp) {
        std::sort(this->begin(), this->end(), comp);
        return *this;
    }

    template<class Comp>
    vt<T>& sort(Comp comp, int reverse) {
        if (!reverse) std::sort(this->begin(), this->end(), comp);
        else std::sort(this->begin(), this->end(), [&](const T& a, const T& b){ return comp(b, a); });
        return *this;
    }

    int find(const T& x) {
        for (int i = 0; i < static_cast<int>(this->size()); ++i) if ((*this)[i] == x) return i;
        return this->size();
    }

    bool has(const T& x) { return find(x) != this->size(); }

    T min() const {
        if (this->empty()) {
            if constexpr (std::is_arithmetic<T>::value) return std::numeric_limits<T>::max();
            else return T{};
        }
        return *std::min_element(this->begin(), this->end());
    }

    T max() const {
        if (this->empty()) {
            if constexpr (std::is_arithmetic<T>::value) return std::numeric_limits<T>::lowest();
            else return T{};
        }
        return *std::max_element(this->begin(), this->end());
    }
    template<class U = T>
    U sum(U init = U{}) const { U s = init; for (const auto& e : *this) s += static_cast<U>(e); return s; }
    vt<T> &iota(T s = T{}) { for (int i = 0; i < this->size(); i++) (*this)[i] = s++; return *this; }
    vt<T> &rem_dupe() { sort(); this->erase(unique(this->begin(), this->end()), this->end()); return *this; }
    vt<T> &shuffle() { std::shuffle(this->begin(), this->end(), mt); return *this; }
    int lower_bound(const T &x) const { return std::lower_bound(this->begin(), this->end(), x) - this->begin(); }
    int upper_bound(const T &x) const &{ return std::upper_bound(this->begin(), this->end(), x) - this->begin(); }
};

template <class T>
using vvt = vt<vt<T>>;
template <class T>
using vvvt = vt<vvt<T>>;
template <class T>
using vvvvt = vector<vvvt<T>>;
template <class T>
using vvvvvt = vector<vvvvt<T>>;

#define vv(type, name, h, ...) \
    vvt<type> name(h, vt<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...)   \
    vvvt<type> name( \
        h, vvt<type>(w, vt<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...)	   \
    vvvvt<type> name( \
        a, vvvt<type>(	   \
            b, vvt<type>(c, vt<type>(__VA_ARGS__))))

using str = string;
using ll = long long;
using ull = unsigned long long;
using lll = __int128_t;
using ulll = __uint128_t;
using db = double;
using ldb = long double;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<db, db>;
using vi = vt<int>;
using vl = vt<ll>;
using vb = vt<bool>;
using vdb = vt<db>;
using vvi = vt<vt<int>>;
using vvl = vt<vt<ll>>;
using vvb = vt<vt<bool>>;
using vs = vt<str>;
using vpi = vt<pi>;
using vpl = vt<pl>;

const ll mod = 998244353;
/*
const ll mod = 1e9 + 7;
*/
const int precision = 24;

const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();

struct chash { // large odd number for C
    const uint64_t C = ll(4e18 * acos(0)) | 71;
    ll operator()(ll x) const { return __builtin_bswap64((x ^ RANDOM) * C); }
};

#define gptable gp_hash_table
#define priority_queue std::priority_queue
template<class K, class V, class hash> gptable<K, V, hash> make_gptable() {
    return gptable<K, V, hash>({}, {}, {}, {}, {1 << 16});
}

#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define bg(x) begin(x)
#define en(x) end(x) 
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define size(x) (static_cast<int>((x).size()))
#define sq(x) ((x) * (x))
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#ifndef LOCAL
#define endl '\n'
#endif

#define lwb lower_bound
#define upb upper_bound

#define cmp(exp) [&] (const auto& x, const auto& y) { return exp; }

#define __NARG__(...)  __NARG_I_(__VA_ARGS__,__RSEQ_N())
#define __NARG_I_(...) __ARG_N(__VA_ARGS__)
#define __ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
#define __RSEQ_N() 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0

#define _VFUNC_(name, n) name##n
#define _VFUNC(name, n) _VFUNC_(name, n)
#define VFUNC(func, ...) _VFUNC(func, __NARG__(__VA_ARGS__)) (__VA_ARGS__)

#define FOR1(a) for (int _ = 0; _ < (a); _++)
#define FOR2(i, b) for (int i = 0; i < (b); i++)
#define FOR3(i, a, b) for (int i = (a); i < (b); i++)
#define ROF2(i, b) for (int i = (b) - 1; i >= 0; i--)
#define ROF3(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define F0R(i, b) for (int i = 0; i < (b); i++)

#define each2(a, x) for (auto& a : x)
#define each3(a, b, x) for (auto& [a, b] : x)
#define each4(a, b, c, x) for (auto& [a, b, c] : x)
#define reach2(a, x) for (auto it = rbegin(x); it != rend(x); it++) if (auto& a = *it; 1)
#define reach3(a, x) for (auto it = rbegin(x); it != rend(x); it++) if (auto& [a, b] = *it; 1)
#define reach4(a, x) for (auto it = rbegin(x); it != rend(x); it++) if (auto& [a, b, c] = *it; 1)

#define enum3(i, a, x) if (int i = 0; 1) for (auto it = begin(x); it != end(x); it++, i++) if (auto& a = *it; 1)
#define enum4(i, a, b, x) if (int i = 0; 1) for (auto it = begin(x); it != end(x); it++, i++) if (auto& [a, b] = *it; 1)
#define enum5(i, a, b, c, x) if (int i = 0; 1) for (auto it = begin(x); it != end(x); it++, i++) if (auto& [a, b, c] = *it; 1)
#define renum3(i, a, x) if (int i = ((int) size(x)) - 1; 1) for (auto it = rbegin(x); it != rend(x); it++, i--) if (auto& a = *it; 1)
#define renum4(i, a, b, x) if (int i = ((int) size(x)) - 1; 1) for (auto it = rbegin(x); it != rend(x); it++, i--) if (auto& [a, b] = *it; 1)
#define renum5(i, a, b, c, x) if (int i = ((int) size(x)) - 1; 1) for (auto it = rbegin(x); it != rend(x); it++, i--) if (auto& [a, b, c] = *it; 1)

#define FOR(...) VFUNC(FOR, __VA_ARGS__)
#define ROF(...) VFUNC(ROF, __VA_ARGS__)
#define each(...) VFUNC(each, __VA_ARGS__)
#define reach(...) VFUNC(reach, __VA_ARGS__)
#define enum(...) VFUNC(enum, __VA_ARGS__)
#define renum(...) VFUNC(renum, __VA_ARGS__)

#define lam1(x) [&] () { return x; }
#define lam2(x, y) [&] (x) { return y;}
#define lam3(x, y, z) [&] (x, y) { return z; }
#define lam4(w, x, y, z) [&] (w, x, y) { return z; }

#define lam(...) VFUNC(lam, __VA_ARGS__)

template<class Fun> class y_combinator_result {
    Fun fun_;
public:
    template<class T> explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}
    template<class ...Args> decltype(auto) operator()(Args &&...args) { return fun_(std::ref(*this), std::forward<Args>(args)...); }
};
template<class Fun> decltype(auto) ycomb(Fun &&fun) { return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun)); }

ll mpow(ll x, ll y = mod - 2) {
    ll res = 1;
    for (; y; x = (x * x) % mod, y >>= 1) if (y & 1) res = (res * x) % mod;
    return res;
}
ll mpow(ll x, ll y, ll mod) {
    ll res = 1;
    for (; y; x = (x * x) % mod, y >>= 1) if (y & 1) res = (res * x) % mod;
    return res;
}
ll gen(ll l, ll r) { return uniform_int_distribution<ll>(l, r)(mt); }

int rs, cs;
const int dr[5] {0, -1, 0, 1, 0}, dc[5] {1, 0, -1, 0, 0};
bool valid(int r, int c) { return r >= 0 && c >= 0 && r < rs && c < cs; }
vpi get_adj(int r, int c) {
    vpi ret(4);
    FOR (i, 4) ret[i] = {r + dr[i], c + dc[i]};
    return ret;
}
vpi get_valid_adj(int r, int c) {
    vpi ret;
    FOR (i, 4) {
        int nr = r + dr[i];
        int nc = c + dc[i];
        if (valid(nr, nc)) ret.eb(nr, nc);
    }
    return ret;
}

constexpr int pct(int x) { return __builtin_popcount(x); }
constexpr int pctl(ll x) { return __builtin_popcountll(x); }
// 2 ^ bits(n) is the largest power of 2 <= n
constexpr int bits(int x) { return x ? 31 - __builtin_clz(x) : 0; }
constexpr int bits(ll x) { return x ? 63 - __builtin_clzll(x) : 0; }
constexpr int p2(int x) { return 1 << x; }
constexpr ll p2l(int x) { return 1ll << x; }
constexpr int msk2(int x) { return p2(x) - 1; }
constexpr ll msk2l(int x) { return p2l(x) - 1; }

ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); }
ll fdiv(ll a, ll b) { return a / b - ((a ^ b) < 0 && a % b); }

namespace IO {
#ifndef LOCAL
    const int BSZ = 1 << 15;
    char ibuf[BSZ]; int ipos, ilen;
    char _next_char() {
        if (ipos == ilen) {
            ipos = 0;
            ilen = fread(ibuf, 1, BSZ, stdin);
            if (!ilen) return EOF;
        }
        return ibuf[ipos++];
    }
    char _nc() {
        char ch;
        while (isspace(ch = _next_char()));
        return ch;
    }
    void _rc(char& ch) {
        while (isspace(ch = _next_char()));
    }
    string _ns() {
        string x;
        char ch; while (isspace(ch = _next_char()));
        do { x += ch; } while (!isspace(ch = _next_char()) && ch != EOF);
        return x;
    }
    void _rs(string& x) {
        x.clear();
        char ch; while (isspace(ch = _next_char()));
        do { x += ch; } while (!isspace(ch = _next_char()) && ch != EOF);
    }
    int _ni() {
        int x, sgn = 1;
        char ch;
        while (!isdigit(ch = _next_char())) if (ch == '-') sgn *= -1;
        x = ch - '0';
        while (isdigit(ch = _next_char())) x = x * 10 + (ch - '0');
        return x * sgn;
    }
    ll _nl() {
        ll x, sgn = 1;
        char ch;
        while (!isdigit(ch = _next_char())) if (ch == '-') sgn *= -1;
        x = ch - '0';
        while (isdigit(ch = _next_char())) x = x * 10 + (ch - '0');
        return x * sgn;
    }
    template<class T> void _ri(T& x) {
        char ch;
        int sgn = 1;
        while (!isdigit(ch = _next_char())) if (ch == '-') sgn *= -1;
        x = ch - '0';
        while (isdigit(ch = _next_char())) x = x * 10 + (ch - '0');
        x *= sgn;
    }
    template<class T, class... Ts> void _ri(T& t, Ts&... ts) { _ri(t); _ri(ts...); }
    char obuf[BSZ], numBuf[100]; int opos;
    void flushOut() {
        fwrite(obuf, 1, opos, stdout); opos = 0;
    }
    void _wc(char c) {
        if (opos == BSZ) flushOut();
        obuf[opos++] = c;
    }
    void _ws(string s) { for (char& c : s) _wc(c); }
    template<class T> void _wi(T x) {
        if (x < 0) _wc('-'), x *= -1;
        int len = 0;
        for (; x >= 10; x /= 10) numBuf[len++] = '0' + (x % 10);
        _wc('0' + x);
        for (int i = len - 1; i >= 0; i--) _wc(numBuf[i]);
    }
    template <typename T>
    typename std::enable_if<std::is_floating_point<T>::value>::type _rf(T &x) {
        str in; _rs(in); x = stold(in);
    }
    template <typename T>
    typename std::enable_if<std::is_floating_point<T>::value>::type _wf(T& x) {
        ostringstream sout;
        sout << std::fixed << std::setprecision(precision) << x;
        str out = sout.str();
        each(c, out) _wc(c);
    }
    long double _nf() { long double x; _rf(x); return x; }
    void initO() { assert(atexit(flushOut) == 0); }
#else
    char _nc() { char ch; cin >> ch; return ch; }
    void _rc(char& ch) { cin >> ch; }
    string _ns() { string x; cin >> x; return x; }
    void _rs(string& x) { cin >> x; }
    int _ni() { int x; cin >> x; return x; }
    ll _nl() { ll x; cin >> x; return x; }
    template<class T> void _ri(T& x) { cin >> x; }
    template<class T, class... Ts> void _ri(T& t, Ts&... ts) { ri(t); ri(ts...); }
    void _wc(char c) {
        if (c == '\n') cout << endl;
        else cout << c;
    }
    void _ws(string s) { cout << s; }
    template<class T> void _wi(T x) { cout << x; }
    template <typename T>
    typename std::enable_if<std::is_floating_point<T>::value>::type _rf(T &x) { cin >> x; }
    template <typename T>
    typename std::enable_if<std::is_floating_point<T>::value>::type _wf(T& x) { cout << std::fixed << std::setprecision(precision) << x; }
    long double _nf() { long double x; _rf(x); return x; }
    void initO() { cin.tie(0)->sync_with_stdio(0); }
#endif
}

void setfileaio(string name) {
#ifndef LOCAL
    if (name == "") return;
    freopen((name + "in.txt").c_str(), "r", stdin);
    freopen((name + "out.txt").c_str(), "w", stdout);
#endif
}

void setfile(string pfx) {
#ifndef LOCAL
    if (pfx == "") return;
    freopen((pfx + ".in").c_str(), "r", stdin);
    freopen((pfx + ".out").c_str(), "w", stdout);
#endif
}

template<typename... Args> // tuples
ostream& operator<<(ostream& os, tuple<Args...> t) {
    apply([&](Args... args) { string dlm = "{"; ((os << dlm << args, dlm = ", "), ...); }, t);
    return os << "}";
}

template<typename T, typename V> // pairs
ostream& operator<<(ostream& os, pair<T, V> p) { return os << "{" << p.f << ", " << p.s << "}"; }

template<typename T, typename V>
istream& operator>>(istream& os, pair<T, V> p) { return os >> p.f >> p.s; }

template<class T, class = decltype(begin(declval<T>()))> // iterables
typename enable_if<!is_same<T, string>::value, ostream&>::type operator<<(ostream& os, const T& v) {
    os << "{";
    string dlm = "";
    for (auto i : v) os << dlm << i, dlm = ", ";
    return os << "}";
}

void read(char& x) { x = IO::_nc(); }
template<typename T>
typename enable_if<is_integral<T>::value>::type read(T& x) { IO::_ri(x); }
template <typename T>
typename std::enable_if<std::is_floating_point<T>::value>::type read(T &x) { IO::_rf(x); }
void read(bool& x) { char c; read(c); x = (c == '1'); }
void read(string& x) { IO::_rs(x); }
template<typename... Args> 
void read(tuple<Args...>& t) { apply([&](Args&... args) {((read(args)), ...); }, t); }
template<class T, class U> void read(pair<T, U>& x) { read(x.f); read(x.s); }
template<class T, class = decltype(begin(declval<T>()))>
typename enable_if<!is_same<T, string>::value>::type read(T& v) { for (auto& i : v) read(i); }
template<class T, class... Ts> void read(T& t, Ts&... ts) { read(t); read(ts...); }

void _print(const char& c) { IO::_wc(c); }
template<typename T>
typename enable_if<is_integral<T>::value>::type _print(T x) { IO::_wi(x); }
template <typename T>
typename std::enable_if<std::is_floating_point<T>::value>::type _print(T& x) { IO::_wf(x); }
void _print(const bool& x) { IO::_wi(x); }
void _print(const string& x) { IO::_ws(x); }
void _print(const char* x) { IO::_ws(x); }
template<typename... Args> 
void _print(tuple<Args...> t) { string delim = ""; apply([&](Args... args) {((_print(delim), _print(args), delim = ' '), ...); }, t); }
template<class T, class U>
void _print(const pair<T, U>& x) { _print(x.first); _print(' '); _print(x.second); }
template<class T, class = decltype(begin(declval<T>()))>
typename enable_if<!is_same<T, string>::value>::type _print(const T& v) { each(i, v) _print(i), _print(' '); }
template<class T> void print(const T& t) { _print(t); _print(' '); }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { _print(t); _print(' '); print(ts...); }
template <typename T>
void print(initializer_list<T> args) { each(e, args) _print(e); }
void println() { _print('\n'); }
template<class T> void println(const T& t) { _print(t); _print('\n'); }
template<class T, class... Ts> void println(const T& t, const Ts&... ts) { _print(t); _print(' '); println(ts...); }
template<class T>
void println(initializer_list<T> args) { each(e, args) _print(e); _print('\n'); }

int nxti() { return IO::_ni(); }
ll nxtl() { return IO::_nl(); }
char nxtc() { return IO::_nc(); }

#define ri1(a) int a = IO::_ni()
#define ri2(a, b) int a = IO::_ni(); int b = IO::_ni()
#define ri3(a, b, c) int a = IO::_ni(); int b = IO::_ni(); int c = IO::_ni()
#define ri4(a, b, c, d) int a = IO::_ni(); int b = IO::_ni(); int c = IO::_ni(); int d = IO::_ni()
#define rid1(a) int a = IO::_ni() - 1
#define rid2(a, b) int a = IO::_ni() - 1; int b = IO::_ni() - 1
#define rid3(a, b, c) int a = IO::_ni() - 1; int b = IO::_ni() - 1; int c = IO::_ni() - 1
#define rid4(a, b, c, d) int a = IO::_ni() - 1; int b = IO::_ni() - 1; int c = IO::_ni() - 1; int d = IO::_ni() - 1
#define rl1(a) ll a = IO::_nl()
#define rl2(a, b) ll a = IO::_nl(); ll b = IO::_nl()
#define rl3(a, b, c) ll a = IO::_nl(); ll b = IO::_nl(); ll c = IO::_nl()
#define rl4(a, b, c, d) ll a = IO::_nl(); ll b = IO::_nl(); ll c = IO::_nl(); ll d = IO::_nl()
#define rd1(a) db a = IO::_nf()
#define rd2(a, b) db a = IO::_nf(); db b = IO::_nf()
#define rd3(a, b, c) db a = IO::_nf(); db b = IO::_nf(); db c = IO::_nf()
#define rd4(a, b, c, d) db a = IO::_nf(); db b = IO::_nf(); db c = IO::_nf(), db d = IO::_nf()
#define rc1(a) char a = IO::_nc()
#define rc2(a, b) char a = IO::_nc(); char b = IO::_nc()
#define rc3(a, b, c) char a = IO::_nc(); char b = IO::_nc(); char c = IO::_nc()
#define rc4(a, b, c, d) char a = IO::_nc(); char b = IO::_nc(); char c = IO::_nc(); char d = IO::_nc()
#define rs1(a) string a = IO::_ns()
#define rs2(a, b) string a = IO::_ns(); string b = IO::_ns()
#define rvi(a, n) vi a(n); FOR (i, n) IO::_ri(a[i])
#define rvid(a, n) vi a(n); FOR (i, n) IO::_ri(a[i]), a[i]--;
#define rvl(a, n) vl a(n); FOR (i, n) IO::_ri(a[i])
#define rvb(a, n) vb a(n); FOR (i, n) a[i] = (nxtc() == '1')

#define ri(...) VFUNC(ri, __VA_ARGS__)
#define rid(...) VFUNC(rid, __VA_ARGS__)
#define rl(...) VFUNC(rl, __VA_ARGS__)
#define rd(...) VFUNC(rd, __VA_ARGS__)
#define rc(...) VFUNC(rc, __VA_ARGS__)
#define rs(...) VFUNC(rs, __VA_ARGS__)

const int inf = 1e9;
const ll INF = 1e18;
const db eps = 1e-9;

template<class T> bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

int YES() { println("YES"); return 0; }
int NO() { println("NO"); return 0; }
int Yes() { println("Yes"); return 0; }
int No() { println("No"); return 0; }
#define ret(x) { x; return; }
#define exit(x) { x; exit(0); }

#ifdef LOCAL
template <typename T, typename... V>
void printer(string pfx, const char *names, T&& head, V&& ...tail) {
    int i = 0, brackets = 0;
    while (names[i] && (names[i] != ',' || brackets)) {
        if (names[i] == '(' || names[i] == '{') brackets++;
        if (names[i] == ')' || names[i] == '}') brackets--;
        i++;
    }
    constexpr bool is_str = is_same_v<decay_t<T>, const char*>;
    if (is_str) cerr << " " << head;
    else cerr << pfx, cerr.write(names, i) << " = " << head; 
    if constexpr (sizeof...(tail)) printer(is_str ? "" : ",", names + i + 1, tail...);
    else cerr << endl;
}

#define dbg(...) printer(to_string(__LINE__) + ": ", #__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(x...)
#define cerr if (0) std::cerr
#endif

/*



*/

signed main() {
    IO::initO(); 

    ri(n, q);
    rvi(a, n);
    vl cnt(n + 1), cnti(n + 1), cntii(n + 1);
    FOR (i, n) {
        cnt[i + 1] += a[i];
        cnti[i + 1] += 1ll * a[i] * i;
        cntii[i + 1] += 1ll * a[i] * i * i;
    }
    FOR (i, n) {
        cnt[i + 1] += cnt[i];
        cnti[i + 1] += cnti[i];
        cntii[i + 1] += cntii[i];
    }
    FOR (q) {
        rid(l, r);
        r++;
        int l0 = l - 1; // bruh
        ll c = cnt[r] - cnt[l];
        ll ci = cnti[r] - cnti[l];
        ll cii = cntii[r] - cntii[l];
        ll ans = (l0 + r) * ci - cii - c * l0 * r;
        println(ans);
    }
}

提出情報

提出日時
問題 E - Sum of Subarrays
ユーザ caterpillow
言語 C++ 17 (gcc 12.2)
得点 475
コード長 20529 Byte
結果 AC
実行時間 43 ms
メモリ 14356 KiB

コンパイルエラー

Main.cpp: In instantiation of ‘void IO::_wi(T) [with T = bool]’:
Main.cpp:423:37:   required from here
Main.cpp:325:15: warning: comparison of constant ‘0’ with boolean expression is always false [-Wbool-compare]
  325 |         if (x < 0) _wc('-'), x *= -1;
      |             ~~^~~
Main.cpp:325:32: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
  325 |         if (x < 0) _wc('-'), x *= -1;
      |                              ~~^~~~~
Main.cpp:327:18: warning: comparison of constant ‘10’ with boolean expression is always false [-Wbool-compare]
  327 |         for (; x >= 10; x /= 10) numBuf[len++] = '0' + (x % 10);
      |                ~~^~~~~
Main.cpp: In function ‘void setfileaio(std::string)’:
Main.cpp:371:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  371 |     freopen((name + "in.txt").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:372:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  372 |     freopen((name + "out.txt").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp: In function ‘void setfile(std::string)’:
Main.cpp:379:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  379 |     freopen((pfx + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:380:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  380 |     freopen((pfx + ".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 475 / 475
結果
AC × 1
AC × 16
セット名 テストケース
Sample sample00.txt
All sample00.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt
ケース名 結果 実行時間 メモリ
sample00.txt AC 1 ms 3508 KiB
testcase00.txt AC 1 ms 3504 KiB
testcase01.txt AC 5 ms 3484 KiB
testcase02.txt AC 26 ms 5352 KiB
testcase03.txt AC 19 ms 4708 KiB
testcase04.txt AC 19 ms 8148 KiB
testcase05.txt AC 18 ms 10276 KiB
testcase06.txt AC 8 ms 4264 KiB
testcase07.txt AC 25 ms 5644 KiB
testcase08.txt AC 43 ms 13744 KiB
testcase09.txt AC 43 ms 13720 KiB
testcase10.txt AC 43 ms 13724 KiB
testcase11.txt AC 43 ms 13728 KiB
testcase12.txt AC 43 ms 13720 KiB
testcase13.txt AC 43 ms 13716 KiB
testcase14.txt AC 30 ms 14356 KiB