QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#357695 | #3276. 出题高手 | edisnimorF | 0 | 25ms | 65968kb | C++14 | 1.4kb | 2024-03-19 08:24:29 | 2024-03-19 08:24:30 |
Judging History
answer
#include<bits/stdc++.h>
#define il inline
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define pii pair<int, int>
#define fr first
#define sc second
#define ll long long
#define mset(f, z) memset(f, z, sizeof(f))
#define mcpy(f, g) memcpy(f, g, sizeof(g))
using namespace std;
template<typename T=ll>
il T rd(){
T s=0; bool f=1; char c=getchar();
while(!isdigit(c)) f^=(c=='-'), c=getchar();
while(isdigit(c)) s=s*10+c-'0', c=getchar();
return f? s:-s;
}
template<typename T> il void ckmx(T &x, T y){if(x<y) x=y;}
template<typename T> il void ckmn(T &x, T y){if(y<x) x=y;}
char _begin;
#define int ll
#define i128 __int128
const int N=2005;
int n, m, a[N];
pii f[N][N];
void upd(pii &a, pii b){
if(a.fr*b.sc<b.sc*a.sc) a=b;
}
int gcd(int a, int b){
if(!b) return a;
return gcd(b, a%b);
}
char _end;
signed main(){
debug("%lfMB\n", (&_end-&_begin)/1024./1024.);
n=rd();
for(int i=1; i<=n; i++) a[i]=rd();
for(int i=1; i<=n; i++){
int sum=0;
for(int j=i; j<=n; j++){
sum+=a[j];
f[i][j]={sum*sum, j-i+1};
}
}
for(int l=n; l; l--){
for(int r=l+1; r<=n; r++){
upd(f[l][r], f[l][r-1]);
upd(f[l][r], f[l+1][r]);
}
}
m=rd();
for(int i=1; i<=m; i++){
int l=rd(), r=rd();
auto [a, b]=f[l][r];
if(!a) puts("0 1");
else{
int gc=gcd(a, b);
printf("%lld %lld\n", a/gc, b/gc);
}
}
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 25ms
memory: 65968kb
input:
2000 -113 314 -664 697 211 -199 -38 -190 8 -661 910 -811 -113 942 77 433 -261 -368 129 -525 968 -608 -21 38 -562 438 -935 -228 220 333 985 -430 916 586 764 476 794 664 383 503 206 -60 380 -130 -988 -904 -996 -304 -286 31 114 119 850 -942 714 -369 -842 250 -192 -462 -727 -427 -602 126 231 718 121 559...
output:
299532249 1592 155236 7 5569600 33 49182169 49 3000000 17 100681156 97 2134521 79 492032 43 6372450 43 23914845 16 698896 31 4389025 26 1839267 7 25020004 87 3150625 64 1279161 14 26790976 31 33143049 91 9065282 7 157954624 97 28546568 41 10137856 83 25030009 15 597529 7 118461456 97 28462225 56 223...
result:
wrong answer 1st numbers differ - expected: '54826875', found: '299532249'
Subtask #2:
score: 0
Wrong Answer
Test #6:
score: 0
Wrong Answer
time: 2ms
memory: 14676kb
input:
100000 754 792 -680 426 425 347 481 -690 530 378 73 -907 -431 45 -530 -552 440 -890 -15 712 695 -679 -310 13 718 805 193 -291 -877 -74 -355 511 -679 -395 166 -710 -657 -19 874 26 832 507 854 -289 700 -404 472 -302 -977 8 -698 40 766 705 369 838 700 -964 552 -535 -75 -608 -181 -503 468 447 772 904 -2...
output:
result:
wrong answer Answer contains longer sequence [length = 2], but output contains 0 elements
Subtask #3:
score: 0
Runtime Error
Test #11:
score: 0
Runtime Error
input:
500000 794 -75 -596 -322 -945 -908 -609 -164 488 626 -877 -710 140 -120 -475 -837 738 669 634 -643 -682 667 816 -785 -608 -836 -860 -932 242 70 -620 268 -121 288 209 -392 732 750 558 -480 565 327 -217 -891 767 211 -690 -66 813 -889 952 615 432 19 411 800 678 718 522 422 940 -510 -544 449 -357 640 40...
output:
result:
Subtask #4:
score: 0
Runtime Error
Test #16:
score: 0
Runtime Error
input:
100000 -496 -233 354 -632 -196 177 -878 -255 -19 -636 685 -70 101 -975 -406 -988 -965 -205 563 -766 763 511 -116 -746 -129 14 106 928 -457 -257 -283 226 3 899 -359 -792 615 490 -57 986 -243 624 -239 931 -555 -821 -72 -611 -380 -397 248 -132 956 -195 -322 -231 319 -214 837 -379 -931 -301 -4 -673 280 ...
output:
result:
Subtask #5:
score: 0
Wrong Answer
Test #31:
score: 0
Wrong Answer
time: 1ms
memory: 8044kb
input:
100000 139 -485 -497 -818 254 169 -560 22 377 -67 -243 -75 743 -788 -676 -26 -775 371 576 -303 54 733 422 800 445 687 479 -16 -288 259 783 -586 912 616 439 -416 676 -555 172 659 501 -868 337 22 -60 260 603 -982 -149 466 769 -595 -117 949 -544 904 753 20 776 175 -888 937 -792 -647 -615 59 -298 452 -6...
output:
result:
wrong answer Answer contains longer sequence [length = 600000], but output contains 0 elements