Submission #887294

# Submission time Handle Problem Language Result Execution time Memory
887294 2023-12-14T08:28:44 Z chanhchuong123 Janjetina (COCI21_janjetina) C++17
15 / 110
1500 ms 183840 KB
#pragma GCC optimize("Ofast, O3, unroll-loops")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
#define task "HOTPOT"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

static struct FastInput {
  static constexpr int BUF_SIZE = 1 << 20;
  char buf[BUF_SIZE];
  size_t chars_read = 0;
  size_t buf_pos = 0;
  FILE *in = stdin;
  char cur = 0;

  inline char get_char() {
    if (buf_pos >= chars_read) {
      chars_read = fread(buf, 1, BUF_SIZE, in);
      buf_pos = 0;
      buf[0] = (chars_read == 0 ? -1 : buf[0]);
    }
    return cur = buf[buf_pos++];
  }

  inline void tie(int) {}

  inline explicit operator bool() {
    return cur != -1;
  }

  inline static bool is_blank(char c) {
    return c <= ' ';
  }

  inline bool skip_blanks() {
    while (is_blank(cur) && cur != -1) {
      get_char();
    }
    return cur != -1;
  }

  inline FastInput& operator>>(char& c) {
    skip_blanks();
    c = cur;
    return *this;
  }

  inline FastInput& operator>>(string& s) {
    if (skip_blanks()) {
      s.clear();
      do {
        s += cur;
      } while (!is_blank(get_char()));
    }
    return *this;
  }

  template <typename T>
  inline FastInput& read_integer(T& n) {
    // unsafe, doesn't check that characters are actually digits
    n = 0;
    if (skip_blanks()) {
      int sign = +1;
      if (cur == '-') {
        sign = -1;
        get_char();
      }
      do {
        n += n + (n << 3) + cur - '0';
      } while (!is_blank(get_char()));
      n *= sign;
    }
    return *this;
  }

  template <typename T>
  inline typename enable_if<is_integral<T>::value, FastInput&>::type operator>>(T& n) {
    return read_integer(n);
  }

  #if !defined(_WIN32) | defined(_WIN64)
  inline FastInput& operator>>(__int128& n) {
    return read_integer(n);
  }
  #endif

  template <typename T>
  inline typename enable_if<is_floating_point<T>::value, FastInput&>::type operator>>(T& n) {
    // not sure if really fast, for compatibility only
    n = 0;
    if (skip_blanks()) {
      string s;
      (*this) >> s;
      sscanf(s.c_str(), "%lf", &n);
    }
    return *this;
  }
} fast_input;

#define cin fast_input

static struct FastOutput {
  static constexpr int BUF_SIZE = 1 << 20;
  char buf[BUF_SIZE];
  size_t buf_pos = 0;
  static constexpr int TMP_SIZE = 1 << 20;
  char tmp[TMP_SIZE];
  FILE *out = stdout;

  inline void put_char(char c) {
    buf[buf_pos++] = c;
    if (buf_pos == BUF_SIZE) {
      fwrite(buf, 1, buf_pos, out);
      buf_pos = 0;
    }
  }

  ~FastOutput() {
    fwrite(buf, 1, buf_pos, out);
  }

  inline FastOutput& operator<<(char c) {
    put_char(c);
    return *this;
  }

  inline FastOutput& operator<<(const char* s) {
    while (*s) {
      put_char(*s++);
    }
    return *this;
  }

  inline FastOutput& operator<<(const string& s) {
    for (int i = 0; i < (int) s.size(); i++) {
      put_char(s[i]);
    }
    return *this;
  }

  template <typename T>
  inline char* integer_to_string(T n) {
    // beware of TMP_SIZE
    char* p = tmp + TMP_SIZE - 1;
    if (n == 0) {
      *--p = '0';
    } else {
      bool is_negative = false;
      if (n < 0) {
        is_negative = true;
        n = -n;
      }
      while (n > 0) {
        *--p = (char) ('0' + n % 10);
        n /= 10;
      }
      if (is_negative) {
        *--p = '-';
      }
    }
    return p;
  }

  template <typename T>
  inline typename enable_if<is_integral<T>::value, char*>::type stringify(T n) {
    return integer_to_string(n);
  }

  #if !defined(_WIN32) || defined(_WIN64)
  inline char* stringify(__int128 n) {
    return integer_to_string(n);
  }
  #endif

  template <typename T>
  inline typename enable_if<is_floating_point<T>::value, char*>::type stringify(T n) {
    sprintf(tmp, "%.17f", n);
    return tmp;
  }

  template <typename T>
  inline FastOutput& operator<<(const T& n) {
    auto p = stringify(n);
    for (; *p != 0; p++) {
      put_char(*p);
    }
    return *this;
  }
} fast_output;
#define cout fast_output

const int MAX = 100010;
int nNode, k;
int h[MAX];
int fr[MAX];
int to[MAX];
int co[MAX];
int pa[MAX];
int sz[MAX];
int pp[MAX];
bool rem[MAX];
int anc[17][MAX];
int dpW[17][MAX];
vector<int> adj[MAX];
vector<int> tmp[MAX];
vector<vector<int>> tmpSub[MAX];
unordered_map<int, int> mp[MAX];
vector<pair<int, pair<int, int>>> path;

void preDfs(int u, int p) {
    for (int &id: adj[u]) {
        int v = fr[id] ^ to[id] ^ u;

        if (v != p) {
            anc[0][v] = u;
            h[v] = h[u] + 1;
            dpW[0][v] = co[id];

            for (int j = 1; j <= 16; ++j) {
                anc[j][v] = anc[j - 1][anc[j - 1][v]];
                dpW[j][v] = max(dpW[j - 1][v], dpW[j - 1][anc[j - 1][v]]);
            }

            preDfs(v, u);
        }
    }
}

void calc(int u, int v, int &lca, int &maxW) {
    if (h[u] < h[v]) swap(u, v); int k = h[u] - h[v]; maxW = 0;
    for (int j = 0; (1 << j) <= k; ++j) {
        if (k >> j & 1) {
            maxW = max(maxW, dpW[j][u]);
            u = anc[j][u];
        }
    }
    if (u == v) {
        lca = u;
        return;
    }

    for (int j = 16; j >= 0; --j) {
        if (anc[j][u] != anc[j][v]) {
            maxW = max(maxW, dpW[j][u]);
            maxW = max(maxW, dpW[j][v]);
            u = anc[j][u];
            v = anc[j][v];
        }
    }
    maxW = max(maxW, dpW[0][u]);
    maxW = max(maxW, dpW[0][v]);
    lca = anc[0][u];
    return;
}

int dfsSZ(int u, int p) {
    sz[u] = 1;
    for (int &id: adj[u]) {
        int v = fr[id] ^ to[id] ^ u;

        if (v != p && rem[v] == 0) {
            sz[u] += dfsSZ(v, u);
        }
    }
    return sz[u];
}

int findCentroid(int u, int p, int n) {
    for (int &id: adj[u]) {
        int v = fr[id] ^ to[id] ^ u;

        if (v != p && rem[v] == 0) {
            if ((sz[v] << 1) > n)
                return findCentroid(v, u, n);
        }
    }
    return u;
}

void solve(int u, int p, int pos = -1) {
    int c = findCentroid(u, p, dfsSZ(u, p));
    rem[c] = true;
    pp[c] = pos;
    pa[c] = p;

    int cnt = 0;
    for (int &id: adj[c]) {
        int v = fr[id] ^ to[id] ^ c;

        if (v != p && rem[v] == 0) {
            tmpSub[c].emplace_back();
            solve(v, c, cnt++);
        }
    }
}

struct BIT {
    vector<int> bit;
    int n;

    BIT(int _n = 0) {
        n = _n;
        bit.assign(n + 1, 0);
    }

    void update(int id, int delta) {
        for (; id <= n; id += id & -id)
            bit[id] += delta;
    }

    int get(int id) {
        int res = 0;
        id = min(id, n);
        for (; id > 0; id -= id & -id)
            res += bit[id];
        return res;
    }
};
BIT bit[MAX];
vector<BIT> bitSub[MAX];

int main() {

    cin >> nNode >> k;
    for (int i = 1; i < nNode; ++i) {
        cin >> fr[i];
        cin >> to[i];
        cin >> co[i];
        adj[fr[i]].push_back(i);
        adj[to[i]].push_back(i);
    }

    preDfs(1, -1);
    solve(1, -1);

    for (int i = 1; i <= nNode; ++i) {
        for (int ii = i, PP = -1; ii > 0; PP = pp[ii], ii = pa[ii]) {
            int lca, maxW; calc(i, ii, lca, maxW);
            int dist = h[i] + h[ii] - 2 * h[lca];
            mp[ii][i] = PP;
            tmp[ii].push_back(dist);
            if (i != ii) path.push_back({maxW, {i, ii}});
            if (PP != -1) tmpSub[ii][PP].push_back(dist);
        }
    }

    for (int i = 1; i <= nNode; ++i) {
        sort(all(tmp[i])); tmp[i].resize(unique(all(tmp[i])) - tmp[i].begin());
        bitSub[i].resize(tmpSub[i].size());
        bit[i] = BIT(tmp[i].size());
        for (int j = 0; j < tmpSub[i].size(); ++j) {
            sort(all(tmpSub[i][j])); tmpSub[i][j].resize(unique(all(tmpSub[i][j])) - tmpSub[i][j].begin());
            bitSub[i][j] = BIT(tmpSub[i][j].size());
        }
    }

    #define UP(vec, value) (upper_bound(all(vec), value) - vec.begin())
    for (int i = 1; i <= nNode; ++i) {
        for (int ii = i, PP = -1; ii > 0; PP = pp[ii], ii = pa[ii]) {
            int lca, maxW; calc(i, ii, lca, maxW);
            int dist = h[i] + h[ii] - 2 * h[lca];

            bit[ii].update(UP(tmp[ii], dist), +1);
            if (PP != -1) bitSub[ii][PP].update(UP(tmpSub[ii][PP], dist), +1);
        }
    }

    sort(rall(path));
    long long res = 0;

    for (int cur = 0; cur < path.size(); ++cur) {
        int i, ii; tie(i, ii) = path[cur].second;
        int lca, maxW; calc(i, ii, lca, maxW);
        int dist = h[i] + h[ii] - 2 * h[lca];
        int maxL = maxW - k - dist, PP = mp[ii][i];

        assert(PP != -1);
        bit[ii].update(UP(tmp[ii], dist), -1);
        res += bit[ii].get(UP(tmp[ii], maxL));

        bitSub[ii][PP].update(UP(tmpSub[ii][PP], dist), -1);
        res -= bitSub[ii][PP].get(UP(tmpSub[ii][PP], maxL));
    }

    cout << res * 2;

	return 0;
}

Compilation message

Main.cpp:1:47: warning: bad option '-f O3' to pragma 'optimize' [-Wpragmas]
    1 | #pragma GCC optimize("Ofast, O3, unroll-loops")
      |                                               ^
Main.cpp:1:47: warning: bad option '-f unroll-loops' to pragma 'optimize' [-Wpragmas]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
    2 | #pragma GCC target("avx2")
      |                          ^
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes]
Main.cpp:2:26: warning: bad option '-f O3' t
# Verdict Execution time Memory Grader output
1 Correct 13 ms 28248 KB Output is correct
2 Correct 12 ms 40540 KB Output is correct
3 Correct 12 ms 40540 KB Output is correct
4 Correct 16 ms 41560 KB Output is correct
5 Correct 19 ms 41588 KB Output is correct
6 Correct 17 ms 41560 KB Output is correct
7 Correct 16 ms 41564 KB Output is correct
8 Correct 18 ms 41560 KB Output is correct
9 Correct 13 ms 41048 KB Output is correct
10 Correct 13 ms 41052 KB Output is correct
11 Correct 13 ms 41052 KB Output is correct
12 Correct 17 ms 41160 KB Output is correct
13 Correct 15 ms 41224 KB Output is correct
14 Correct 15 ms 41352 KB Output is correct
15 Correct 14 ms 41052 KB Output is correct
16 Correct 14 ms 41224 KB Output is correct
17 Correct 16 ms 41052 KB Output is correct
18 Correct 14 ms 41308 KB Output is correct
19 Correct 15 ms 41052 KB Output is correct
20 Correct 14 ms 41304 KB Output is correct
21 Correct 15 ms 41304 KB Output is correct
22 Correct 16 ms 41304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 28252 KB Output is correct
2 Correct 12 ms 40672 KB Output is correct
3 Correct 12 ms 40664 KB Output is correct
4 Correct 17 ms 41564 KB Output is correct
5 Correct 99 ms 52488 KB Output is correct
6 Correct 674 ms 108752 KB Output is correct
7 Correct 1215 ms 183592 KB Output is correct
8 Correct 1216 ms 183544 KB Output is correct
9 Correct 1459 ms 182136 KB Output is correct
10 Correct 1497 ms 182392 KB Output is correct
11 Correct 1212 ms 182536 KB Output is correct
12 Correct 1215 ms 183268 KB Output is correct
13 Correct 1466 ms 181988 KB Output is correct
14 Correct 1500 ms 183840 KB Output is correct
15 Execution timed out 1522 ms 183508 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 28248 KB Output is correct
2 Correct 12 ms 40540 KB Output is correct
3 Correct 12 ms 40540 KB Output is correct
4 Correct 16 ms 41560 KB Output is correct
5 Correct 19 ms 41588 KB Output is correct
6 Correct 17 ms 41560 KB Output is correct
7 Correct 16 ms 41564 KB Output is correct
8 Correct 18 ms 41560 KB Output is correct
9 Correct 13 ms 41048 KB Output is correct
10 Correct 13 ms 41052 KB Output is correct
11 Correct 13 ms 41052 KB Output is correct
12 Correct 17 ms 41160 KB Output is correct
13 Correct 15 ms 41224 KB Output is correct
14 Correct 15 ms 41352 KB Output is correct
15 Correct 14 ms 41052 KB Output is correct
16 Correct 14 ms 41224 KB Output is correct
17 Correct 16 ms 41052 KB Output is correct
18 Correct 14 ms 41308 KB Output is correct
19 Correct 15 ms 41052 KB Output is correct
20 Correct 14 ms 41304 KB Output is correct
21 Correct 15 ms 41304 KB Output is correct
22 Correct 16 ms 41304 KB Output is correct
23 Correct 10 ms 28252 KB Output is correct
24 Correct 12 ms 40672 KB Output is correct
25 Correct 12 ms 40664 KB Output is correct
26 Correct 17 ms 41564 KB Output is correct
27 Correct 99 ms 52488 KB Output is correct
28 Correct 674 ms 108752 KB Output is correct
29 Correct 1215 ms 183592 KB Output is correct
30 Correct 1216 ms 183544 KB Output is correct
31 Correct 1459 ms 182136 KB Output is correct
32 Correct 1497 ms 182392 KB Output is correct
33 Correct 1212 ms 182536 KB Output is correct
34 Correct 1215 ms 183268 KB Output is correct
35 Correct 1466 ms 181988 KB Output is correct
36 Correct 1500 ms 183840 KB Output is correct
37 Execution timed out 1522 ms 183508 KB Time limit exceeded
38 Halted 0 ms 0 KB -