답안 #1003190

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1003190 2024-06-20T07:37:46 Z vjudge1 쌀 창고 (IOI11_ricehub) C++17
0 / 100
4 ms 1476 KB
/*
    check include bpds 
*/
#include "ricehub.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

template <class T> using ot = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ins insert
#define pb push_back
// #define int long long int
#define pii pair<int, int>
#define endl '\n'
#define drop(x) cout<<(x)<<endl; return;
#define all(x) x.begin(),x.end()

int besthub(int n, int mxL, int arr[], long long B){
    int ans=0;
    /*

        her i ucun ele j tapaqki :
            j<i
            j ni goturmesek i+1 right terefden nese ekstra goture bilirik
    */

    int cnt=0;
    for(int i =1;i<n;i++){
        arr[i]-=arr[0];
    }
    arr[0]=0;

    multiset<pair<int,int>> right;
    multiset<pair<int,int>> goturdum;
    for(int i=0;i<n;i++){
        right.ins({arr[i],i});
    }
    int currsum=0;
    
    while(!right.empty()){
        auto node = (*right.begin());
        if(currsum+ node.first>B){
            break;
        }    
        currsum+=node.first;
        goturdum.insert({node.second,node.first});
        right.erase(right.begin());
        
    }
    // ans=goturdum.size();
    // for(int i=1;i<n;i++){
    //     currsum+=(goturdum.size()) * (arr[i]-arr[i-1]);
    //     while(currsum)


    //     ans=max(ans,(int)goturdum.size());
    // }

    return ans;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:29:9: warning: unused variable 'cnt' [-Wunused-variable]
   29 |     int cnt=0;
      |         ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1476 KB Output isn't correct
2 Halted 0 ms 0 KB -