QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#362862#3276. 出题高手SlongodCompile Error//C++142.0kb2024-03-23 17:24:002024-03-23 17:24:02

Judging History

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

  • [2024-03-23 17:24:02]
  • 评测
  • [2024-03-23 17:24:00]
  • 提交

answer

#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
namespace Slongod{
using ll = long long;
constexpr int N = 5e5+7 , B = 750;
int n , m , a[N] , bl[N];
struct frac{
    ll a , b;
    void yuefen(){ll g = __gcd(a , b); a /= g; b /= g;}
    frac(){a = 0; b = 1;} frac(ll x , ll y){a = x; b = y;}
    bool operator < (const frac&x) const{return a * x.b < x.a * b;}
}ans[N] , now[N] , tag[N];
vector <pair<int,int>> p[N];
inline frac max(const frac&a , const frac&b){return a < b ? b : a;}
void main()
{
    cin >> n; for (int i = 1; i <= n; i++){cin >> a[i]; bl[i] = (i - 1) / B + 1;}
    cin >> m; for (int i = 1 , l , r; i <= m; i++){cin >> l >> r; p[r].push_back({l , i});}
    for (int i = 1; i <= n; i++) {
        for (int j = i , sum = a[i]; j >= 1 and j >= i - 1900; j-- , sum += a[j]) {
            now[j] = max(now[j] , frac(1ll * abs(sum) * abs(sum) , i - j + 1));
            tag[bl[j]] = max(tag[bl[j]] , now[j]);
        }
        for (auto o : p[i]) {
            if (bl[i] == bl[o.first]) {
                for (int j = o.first; j <= i; j++) {
                    ans[o.second] = max(ans[o.second] , now[j]);
                }
            } else {
                for (int j = o.first; bl[j] == bl[o.first]; j++) {
                    ans[o.second] = max(ans[o.second] , now[j]);
                }
                for (int j = bl[o.first] + 1; j < bl[i]; j++) {
                    ans[o.second] = max(ans[o.second] , tag[j]);
                }
                for (int j = i; bl[j] == bl[i]; j--) {
                    ans[o.second] = max(ans[o.second] , now[j]);
                }
            }
        }
    }
    for (int i = 1; i <= m; i++) {
        ans[i].yuefen();
        cout << ans[i].a << ' ' << ans[i].b << '\n';
    }
}
}int main()
{
    ios :: sync_with_stdio(0);
    cin.tie(0) , cout.tie(0);
    return Slongod :: main(),0;
}

詳細信息

In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from answer.code:5:
/usr/include/c++/13/bits/allocator.h: In destructor ‘std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int> > >::_Vector_impl::~_Vector_impl()’:
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = std::pair<int, int>]’: target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/queue:63,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:157:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~