QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#357688#3276. 出题高手edisnimorFCompile Error//C++141.4kb2024-03-19 08:20:472024-03-19 08:20:47

Judging History

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

  • [2024-03-19 08:20:47]
  • 评测
  • [2024-03-19 08:20:47]
  • 提交

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=5e5+5, M=705;

int n, m, a[N];

bool operator <(const pii &x, const pii &y){
	return (i128)x.fr*y.sc<(i128)y.fr*x.sc;
}

pii f[N][N];

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, j-i+1};
		}
	}
	for(int l=n; l; l--){
		for(int r=l+1; r<=n; r++){
			ckmx(f[l][r], f[l][r-1]);
			ckmx(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;
}

Details

answer.code: In function ‘int main()’:
answer.code:61:22: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   61 |                 auto [a, b]=f[l][r];
      |                      ^
/tmp/ccMvDhS4.o: in function `main':
answer.code:(.text.startup+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `_begin' defined in .bss section in /tmp/ccMvDhS4.o
answer.code:(.text.startup+0x10): relocation truncated to fit: R_X86_64_PC32 against symbol `_end' defined in .bss section in answer
answer.code:(.text.startup+0x59): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccMvDhS4.o
answer.code:(.text.startup+0x6f): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccMvDhS4.o
answer.code:(.text.startup+0x10c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccMvDhS4.o
answer.code:(.text.startup+0x630): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccMvDhS4.o
answer.code:(.text.startup+0x78b): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccMvDhS4.o
answer.code:(.text.startup+0x7d3): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccMvDhS4.o
collect2: error: ld returned 1 exit status