QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#362853 | #3276. 出题高手 | Slongod | Compile Error | / | / | C++14 | 3.8kb | 2024-03-23 17:22:59 | 2024-03-23 17:23:00 |
Judging History
answer
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#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;
}
詳細信息
answer.code:22:39: warning: bad option ‘-fwhole-program’ to pragma ‘optimize’ [-Wpragmas] 22 | #pragma GCC optimize("-fwhole-program") | ^ answer.code:29:41: warning: bad option ‘-fstrict-overflow’ to pragma ‘optimize’ [-Wpragmas] 29 | #pragma GCC optimize("-fstrict-overflow") | ^ answer.code:31:41: warning: bad option ‘-fcse-skip-blocks’ to pragma ‘optimize’ [-Wpragmas] 31 | #pragma GCC optimize("-fcse-skip-blocks") | ^ answer.code:45:51: warning: bad option ‘-funsafe-loop-optimizations’ to pragma ‘optimize’ [-Wpragmas] 45 | #pragma GCC optimize("-funsafe-loop-optimizations") | ^ answer.code:57:17: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes] 57 | void yuefen(){ll g = __gcd(a , b); a /= g; b /= g;} | ^ answer.code:57:17: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes] answer.code:57:17: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes] answer.code:57:17: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes] answer.code:58:10: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes] 58 | frac(){a = 0; b = 1;} frac(ll x , ll y){a = x; b = y;} | ^ answer.code:58:10: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes] answer.code:58:10: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes] answer.code:58:10: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes] answer.code:58:43: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes] 58 | frac(){a = 0; b = 1;} frac(ll x , ll y){a = x; b = y;} | ^ answer.code:58:43: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes] answer.code:58:43: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes] answer.code:58:43: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes] answer.code:59:36: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes] 59 | bool operator < (const frac&x) const{return a * x.b < x.a * b;} | ^~~~~ answer.code:59:36: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes] answer.code:59:36: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes] answer.code:59:36: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes] answer.code:62:44: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes] 62 | inline frac max(const frac&a , const frac&b){return a < b ? b : a;} | ^ answer.code:62:44: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes] answer.code:62:44: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes] answer.code:62:44: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes] answer.code:63:11: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes] 63 | void main() | ^ answer.code:63:11: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes] answer.code:63:11: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes] answer.code:63:11: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes] answer.code:95:11: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes] 95 | }int main() | ^ answer.code:95:11: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes] answer.code:95:11: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes] answer.code:95:11: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes] 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:49: /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:6...