답안 #1109625

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1109625 2024-11-07T07:41:58 Z 0pt1mus23 Brunhilda’s Birthday (BOI13_brunhilda) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ins insert      
#define pb push_back
#define endl '\n'
#define putr(x) cout<<x<<endl;return; 
#define all(x) x.begin(),x.end()
int nxt(){ int x;cin>>x; return x; }
const int mod = 1e9 +7, sze = 1e7 +10, inf = INT_MAX, LG = 20;
int dp[sze];
void fast(){
    int n,q;
    cin>>n>>q;
    unordered_map<int,int> ans;x
    int mx = 0;
    priority_queue<pair<int,int>> ev;
    for(int i=1;i<=n;i++){
        int p;cin>>p;
        // event[p].pb(p);
        ev.push({-p,p});
        mx=max(mx,p);
    }
    int c,prev;
    pair<int,int> beg;
    for(int i =1;i<sze;i++){
        dp[i]=inf;
        c=0;
        while(!ev.empty() && (-(ev.top().first )) ==i ) {
            beg = ev.top();
            ev.pop();
            c++;
            // cout<<i<<" "<<beg.first<<" "<<beg.second<<endl;
            if( (i + beg.second) < sze){
                ev.push({ -(i + beg.second) , beg.second });
            }
            prev=  dp[i - beg.second];
            if(i != beg.second){
                if( (--ans[prev]) < 0){
                    ans.erase(prev);
                }
            }
        }
        if( i < mx ){
            dp[i]=1;
        }
        else if(!ans.empty()){
            dp[i]= (*ans.begin()).first+1;
        }
        if(dp[i]<inf){
            ans[dp[i]]+=c;
        }
    }
 
 
    while(q--){
        int v;
        cin>>v;
        if(dp[v]>=inf){
            cout<<"oo"<<endl;
        }
        else{
            cout<<dp[v]<<endl;
        }
    }
}
 
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 
    int tt = 1; 
    // cin>>tt;
 
    while(tt--){
        fast();
    }
 
    return 0;
}

Compilation message

brunhilda.cpp: In function 'void fast()':
brunhilda.cpp:15:32: error: 'x' was not declared in this scope
   15 |     unordered_map<int,int> ans;x
      |                                ^
brunhilda.cpp:22:9: error: 'mx' was not declared in this scope
   22 |         mx=max(mx,p);
      |         ^~
brunhilda.cpp:44:17: error: 'mx' was not declared in this scope
   44 |         if( i < mx ){
      |                 ^~