QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#738493#5352. 吉夫特KiharaToumaCompile Error//C++23544b2024-11-12 19:12:092024-11-12 19:12:11

Judging History

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

  • [2024-11-12 19:12:11]
  • 评测
  • [2024-11-12 19:12:09]
  • 提交

answer

//qoj5352
#include <bits/stdc++.h>
using namespace std;

const int N = 262144 + 10;
const ll P = 1e9 + 7;
int n, a[N], p[N];
ll f[N], ans;

int main(){
    scanf("%d", &n);
	memset(p, 0x3f, sizeof(p));
	for(int i = 1; i <= n; ++ i){
        scanf("%d", &a[i]);
		p[a[i]] = i;
	}
	for(int i = 0; i <= n; ++ i){
		int s = 262143 - a[i];
		for(int j = s; j > 0; j = (j - 1) & s){
			f[a[i]] = (f[a[i]] + (p[a[i]+j] < i ? f[a[i]+j]+1 : 0)) % P;
		}
		ans = (ans + f[a[i]]) % P;
	}
    printf("%lld\n", ans);
    return 0;
}

Details

answer.code:6:7: error: ‘ll’ does not name a type
    6 | const ll P = 1e9 + 7;
      |       ^~
answer.code:8:1: error: ‘ll’ does not name a type
    8 | ll f[N], ans;
      | ^~
answer.code: In function ‘int main()’:
answer.code:20:25: error: ‘f’ was not declared in this scope
   20 |                         f[a[i]] = (f[a[i]] + (p[a[i]+j] < i ? f[a[i]+j]+1 : 0)) % P;
      |                         ^
answer.code:20:83: error: ‘P’ was not declared in this scope
   20 |                         f[a[i]] = (f[a[i]] + (p[a[i]+j] < i ? f[a[i]+j]+1 : 0)) % P;
      |                                                                                   ^
answer.code:22:17: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   22 |                 ans = (ans + f[a[i]]) % P;
      |                 ^~~
      |                 abs
answer.code:22:30: error: ‘f’ was not declared in this scope
   22 |                 ans = (ans + f[a[i]]) % P;
      |                              ^
answer.code:22:41: error: ‘P’ was not declared in this scope
   22 |                 ans = (ans + f[a[i]]) % P;
      |                                         ^
answer.code:24:22: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   24 |     printf("%lld\n", ans);
      |                      ^~~
      |                      abs
answer.code:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
answer.code:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         scanf("%d", &a[i]);
      |         ~~~~~^~~~~~~~~~~~~