QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#387822#7758. Painterberarchegas#Compile Error//C++201.9kb2024-04-12 21:15:162024-04-12 21:15:17

Judging History

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

  • [2024-04-12 21:15:17]
  • 评测
  • [2024-04-12 21:15:16]
  • 提交

answer

#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
 
mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());
    
const int MOD = 1e9 + 7;
const int MAXN = 2e5 + 5;
const ll INF = 1e14;

const int BSIZE = 1;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;

    vector<ll> v(n);

    for(ll & i :v)
        cin >> i;
    
    vector<ll> resp(n), resto(n);

    auto score_back =[&](int id) -> ll {
        ll sum = 0;
        for(int i = id; i >=max(0,id-BSIZE+1); i--){
            sum*=2;
            sum+=v[i];
        }
        return sum;
    };

    auto normalize =[&](ll x){
        if(x < 0)
            return -1;
        if(x > 0)
            return 1;
        if(x == 0)
            return 0;
    };

    auto print_score =[&](int id){
        ll x = resp[id]+resto[id];
        if(x < 0)
            cout << '-';
        if(x > 0)
            cout << '+';
        if(x == 0)
            cout << 0;
    };

    for(int i = 0; i < n; i++){
        resp[i] = v[i];
        if(i < BSIZE){
            print_score(i);
        } else {
            resp[i]+=normalize(resp[i-BSIZE]) * (abs(resp[i-BSIZE])>>BSIZE);
            resto[i] = resto[i-BSIZE];
            if(resto[i-BSIZE] != normalize(resp[i])){
                resp[i]+=resto[i];
                resto[i]*=-1;
            }
            print_score(i);

        }
        if(resp[i] % (1ll<<BSIZE)){
            resto[i] = normalize(resp[i]);
        }
        // cerr << "(" 
    }
    for(int i = 0; i < n; i++)
        cerr << resp[i] << ' ' << (resp[i]>>1) << ' ' << resto[i] << '\n';

    return 0;
}
/*
10
2 -1 4 -7 4 -8 3 -6 4 -7
+0+-+-0-+-2 1 0
0 0 0
4 2 0
-5 -3 -1
1 0 1
-7 -4 -1
-1 -1 -1
-6 -3 -1
0 0 1
-6 -3 -1
*/aasoiudhasudasdhdsa

Details

answer.code:94:3: error: ‘aasoiudhasudasdhdsa’ does not name a type
   94 | */aasoiudhasudasdhdsa
      |   ^~~~~~~~~~~~~~~~~~~
answer.code: In lambda function:
answer.code:45:5: warning: control reaches end of non-void function [-Wreturn-type]
   45 |     };
      |     ^