QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#485321#9107. Zayin and Countpropane#Compile Error//C++201.5kb2024-07-20 16:25:162024-07-20 16:25:16

Judging History

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

  • [2024-07-20 16:25:16]
  • 评测
  • [2024-07-20 16:25:16]
  • 提交

answer

#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
int a[70], len;

ULL f[1 << 10][70];
bool v[1 << 10][70];

ULL dfs(int state, int u, bool lim){
    if (u == 0) return 1;
    if (!lim and v[state][u]){
        return f[state][u];
    }
    v[state][u] = true;
    ULL ans = 0;
    int up = lim ? a[u] : 9;
    for(int i = 0; i <= up; i++){
        if (state >> i & 1){
            ans += dfs(state, u - 1, lim and (i == up));
        }
    }
    return f[state][u] = ans;
}

ULL get(int state, ULL x){
    int len = 0;
    while(x){
        a[++len] = x % 10;
        x /= 10;
    }
    return dfs(state, len, true);
}

int main(){

#ifdef LOCAL
    freopen("data.in", "r", stdin);
    freopen("data.out", "w", stdout);
#endif

    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);

    memset(v, 0, sizeof v);
    int T;
    cin >> T;
    while(T--){
        int state1 = 0, state2 = 0;
        for(int i = 0; i < 10; i++){
            int x;
            cin >> x;
            state1 |= x << i;
        }
        for(int i = 0; i < 10; i++){
            int x;
            cin >> x;
            state2 |= x << i;
        }
        ULL x;
        cin >> x;
        LL cnt = get(state1, x);
        ULL l = 0, r = ULLONG_MAX;
        while(l < r){
            ULL mid = (l + r) / 2;
            if (get(state2, mid) >= cnt) r = mid;
            else l = mid + 1;
        }
        cout << r << '\n';
    }

}

詳細信息

answer.code: In function ‘int main()’:
answer.code:66:24: error: ‘ULLONG_MAX’ was not declared in this scope
   66 |         ULL l = 0, r = ULLONG_MAX;
      |                        ^~~~~~~~~~
answer.code:4:1: note: ‘ULLONG_MAX’ is defined in header ‘<climits>’; did you forget to ‘#include <climits>’?
    3 | #include<vector>
  +++ |+#include <climits>
    4 | using namespace std;