QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#775348#9745. 递增序列bluejellyfishCompile Error//C++231.5kb2024-11-23 15:36:092024-11-23 15:36:11

Judging History

This is the latest submission verdict.

  • [2024-11-23 15:36:11]
  • Judged
  • [2024-11-23 15:36:09]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int inf = numeric_limits<int>::max();
const int S = 64;

void miss() {
    int n, k; cin >> n >> k;
    vector<int> a(n + 1) , b(S , -1); 
    for(int i = 1 ; i <= n ; i ++) {
		cin >> a[i];
		if(ai[i] != 10 && n == 200000) cout << i << " ";
	}
    auto check = [&](int x , int y) -> bool {
        for(int i = 62 ; ~i ; i --) if((x >> i & 1) != (y >> i & 1)) {
            int ok = 1;
            if((x >> i & 1) < (y >> i & 1)) ok = 0;
            if(b[i] == (ok ^ 1)) return false;
            else b[i] = ok;
            return true;
        }
        return true;
    };

    for(int i = 1 ; i < n ; i ++) if(!check(a[i],a[i + 1])) {
        return cout << "0\n" , void();
    }
    vector<int> dp(S , -1);
    auto dfs = [&](auto self , int pos , int limit) -> int{
        if(!~pos) return 1;
        if(!limit && dp[pos] != -1) return dp[pos];
        int up = 1 , now = k >> pos & 1;
        if(limit && !now) up = 0;
        int ans = 0;
        if(b[pos] == -1) for(int i = 0 ; i <= up ; i ++) ans += self(self,pos - 1,limit&(now == i));
        else if(b[pos] <= up) ans += self(self,pos - 1,limit&(now == b[pos]));
        if(!limit) dp[pos] = ans;
        return ans;
    };
    cout << dfs(dfs,62,1) << "\n";
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T = 1;
    cin >> T;
    while(T--) miss();
	//system("pause");
}

詳細信息

answer.code: In function ‘void miss()’:
answer.code:12:20: error: ‘ai’ was not declared in this scope; did you mean ‘i’?
   12 |                 if(ai[i] != 10 && n == 200000) cout << i << " ";
      |                    ^~
      |                    i