답안 #1109600

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1109600 2024-11-07T06:50:46 Z 0pt1mus23 Brunhilda’s Birthday (BOI13_brunhilda) C++14
0 / 100
46 ms 17796 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 = 1e5 +10, inf = INT_MAX, LG = 20;
int dp[sze];
vector<pair<int,int>> event[sze];
void fast(){
    for(int i=1;i<sze;i++){
        dp[i]=inf;
    }
    int n,q;
    cin>>n>>q;
    multiset<int> ans; 
    int mx = 0;
    for(int i=1;i<=n;i++){
        int p;cin>>p;
        event[p].pb({p,p});
        mx=max(mx,p);
    }
    for(int i =1;i<sze;i++){
        for(auto v:event[i]){
            if(ans.find(dp[v.first]) !=ans.end() ){
                ans.erase(ans.find(dp[v.first]));
            }
        }
        if( ans.empty() ){
            if(i < mx){
                dp[i]=1;
            }
        }
        else{
            dp[i]= (*ans.begin())+1;
        }
        if(dp[i]<inf){
            for(auto v:event[i]){
                ans.ins(dp[i]);
                event[i + v.second].pb({i,v.second});
            }
        }
    }


    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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 3408 KB Output isn't correct
2 Runtime error 22 ms 12516 KB Execution killed with signal 11
3 Runtime error 15 ms 11344 KB Execution killed with signal 11
4 Runtime error 8 ms 7248 KB Execution killed with signal 11
5 Runtime error 11 ms 8528 KB Execution killed with signal 11
6 Incorrect 4 ms 3408 KB Output isn't correct
7 Runtime error 15 ms 11344 KB Execution killed with signal 11
8 Runtime error 18 ms 12880 KB Execution killed with signal 11
9 Runtime error 26 ms 14160 KB Execution killed with signal 11
10 Runtime error 27 ms 14920 KB Execution killed with signal 11
11 Runtime error 21 ms 12624 KB Execution killed with signal 11
12 Runtime error 8 ms 7248 KB Execution killed with signal 11
13 Runtime error 46 ms 17796 KB Execution killed with signal 11
14 Runtime error 45 ms 17732 KB Execution killed with signal 11
15 Runtime error 22 ms 12368 KB Execution killed with signal 11
16 Runtime error 23 ms 12368 KB Execution killed with signal 11
17 Runtime error 12 ms 8528 KB Execution killed with signal 11
18 Runtime error 8 ms 7260 KB Execution killed with signal 11
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 6992 KB Execution killed with signal 11
2 Runtime error 7 ms 6992 KB Execution killed with signal 11
3 Runtime error 8 ms 7248 KB Execution killed with signal 11
4 Runtime error 12 ms 8528 KB Execution killed with signal 11
5 Runtime error 8 ms 7204 KB Execution killed with signal 11
6 Runtime error 13 ms 9040 KB Execution killed with signal 11
7 Runtime error 7 ms 6836 KB Execution killed with signal 11
8 Runtime error 14 ms 9080 KB Execution killed with signal 11
9 Runtime error 8 ms 7248 KB Execution killed with signal 11
10 Runtime error 8 ms 7248 KB Execution killed with signal 11
11 Runtime error 9 ms 7248 KB Execution killed with signal 11
12 Runtime error 23 ms 11600 KB Execution killed with signal 11
13 Runtime error 7 ms 6904 KB Execution killed with signal 11
14 Runtime error 12 ms 8528 KB Execution killed with signal 11
15 Runtime error 8 ms 7248 KB Execution killed with signal 11
16 Runtime error 6 ms 6992 KB Execution killed with signal 11
17 Runtime error 36 ms 14928 KB Execution killed with signal 11
18 Runtime error 8 ms 7248 KB Execution killed with signal 11
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 7248 KB Execution killed with signal 11
2 Runtime error 8 ms 7248 KB Execution killed with signal 11
3 Runtime error 8 ms 7248 KB Execution killed with signal 11
4 Runtime error 22 ms 10728 KB Execution killed with signal 11
5 Runtime error 7 ms 6992 KB Execution killed with signal 11
6 Runtime error 7 ms 7444 KB Execution killed with signal 11
7 Runtime error 7 ms 7248 KB Execution killed with signal 11
8 Runtime error 7 ms 7248 KB Execution killed with signal 11
9 Runtime error 7 ms 7244 KB Execution killed with signal 11
10 Runtime error 19 ms 10604 KB Execution killed with signal 11
11 Runtime error 15 ms 9808 KB Execution killed with signal 11
12 Runtime error 24 ms 12112 KB Execution killed with signal 11
13 Runtime error 8 ms 7248 KB Execution killed with signal 11
14 Runtime error 33 ms 15336 KB Execution killed with signal 11
15 Runtime error 36 ms 13132 KB Execution killed with signal 11
16 Runtime error 30 ms 13640 KB Execution killed with signal 11
17 Runtime error 7 ms 7248 KB Execution killed with signal 11
18 Runtime error 8 ms 7248 KB Execution killed with signal 11
19 Runtime error 6 ms 6736 KB Execution killed with signal 11
20 Runtime error 8 ms 7504 KB Execution killed with signal 11
21 Runtime error 36 ms 16728 KB Execution killed with signal 11
22 Runtime error 9 ms 7260 KB Execution killed with signal 11
23 Runtime error 7 ms 7160 KB Execution killed with signal 11
24 Runtime error 8 ms 7516 KB Execution killed with signal 11
25 Runtime error 24 ms 11868 KB Execution killed with signal 11
26 Runtime error 20 ms 10836 KB Execution killed with signal 11
27 Runtime error 8 ms 7484 KB Execution killed with signal 11
28 Runtime error 6 ms 6752 KB Execution killed with signal 11
29 Runtime error 9 ms 7260 KB Execution killed with signal 11
30 Runtime error 14 ms 7272 KB Execution killed with signal 11
31 Runtime error 7 ms 7004 KB Execution killed with signal 11
32 Runtime error 14 ms 8812 KB Execution killed with signal 11
33 Runtime error 6 ms 6748 KB Execution killed with signal 11
34 Runtime error 7 ms 7260 KB Execution killed with signal 11
35 Runtime error 6 ms 6992 KB Execution killed with signal 11
36 Runtime error 8 ms 7248 KB Execution killed with signal 11
37 Runtime error 7 ms 6992 KB Execution killed with signal 11
38 Runtime error 8 ms 7248 KB Execution killed with signal 11
39 Runtime error 8 ms 6992 KB Execution killed with signal 11
40 Runtime error 8 ms 6992 KB Execution killed with signal 11
41 Runtime error 7 ms 7120 KB Execution killed with signal 11
42 Runtime error 31 ms 13904 KB Execution killed with signal 11