Submission #3024659


Source Code Expand

// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using std::cerr;using std::cin;using std::cout;using std::abs;using std::min;using std::max;using std::swap;using std::map;using std::unordered_map;using std::unordered_set;using std::bitset;using std::pair;using std::set;using std::string;using std::vector;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;using vci=vector<int>;using vcl=vector<ll>;template<typename T>void _dbg(const char*_s,T _h){cerr<<_s<<" = "<<_h<<"\n";}template<typename T,typename...Ts>void _dbg(const char*_s,T _h,Ts..._t){int _b=0;while(((_b+=*_s=='(')-=*_s==')')!=0||*_s!=',')cerr<<*_s++;cerr<<" = "<<_h<<",";_dbg(_s+1,_t...);}
#define f first
#define s second
#define pb emplace_back
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;
ll p[11],c[11];
int32_t main() {
    
    ll n,g;
    cin>>n>>g;
    for(int i=1;i<=n;++i)
        cin>>p[i]>>c[i];
    vector<int> v(n);
    iota(v.begin(), v.end(), 1);
    int ans=123456789;
    do{
        ll cur=g;
        int pot=0;
        for (int i : v){
            int w=p[i];
            while(w&&cur>0){
                pot++;
                w--;
                cur-=i*100;
            }
            if(!w)
                cur -= c[i];
            if(cur<0){
                break;
            }
        }
        ans=min(ans,pot);
    }while(next_permutation(v.begin(), v.end()));
    cout<<ans<<'\n';

    

    return 0;
}

Submission Info

Submission Time
Task C - All Green
User dsd
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1943 Byte
Status TLE
Exec Time 2103 ms
Memory 384 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 4
AC × 23
TLE × 1
Set Name Test Cases
Sample a01, a02, a03, a04
All a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24
Case Name Status Exec Time Memory
a01 AC 1 ms 256 KB
a02 AC 1 ms 256 KB
a03 AC 1 ms 256 KB
a04 AC 1 ms 256 KB
b05 AC 1 ms 256 KB
b06 TLE 2103 ms 256 KB
b07 AC 39 ms 256 KB
b08 AC 1 ms 256 KB
b09 AC 1 ms 256 KB
b10 AC 1 ms 256 KB
b11 AC 1 ms 256 KB
b12 AC 14 ms 256 KB
b13 AC 82 ms 256 KB
b14 AC 960 ms 256 KB
b15 AC 987 ms 256 KB
b16 AC 1352 ms 256 KB
b17 AC 965 ms 256 KB
b18 AC 824 ms 256 KB
b19 AC 765 ms 256 KB
b20 AC 8 ms 256 KB
b21 AC 123 ms 384 KB
b22 AC 730 ms 256 KB
b23 AC 667 ms 256 KB
b24 AC 634 ms 256 KB