Submission #3024675
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];
int g=min(p[i],(cur+i*100-1)/(i*100));
pot+=g;
cur -= g*i*100;
if(g==p[i])
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 |
300 |
Code Size |
1924 Byte |
Status |
AC |
Exec Time |
695 ms |
Memory |
384 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 300 |
Status |
|
|
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 |
AC |
695 ms |
384 KB |
b07 |
AC |
138 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 |
6 ms |
256 KB |
b13 |
AC |
32 ms |
256 KB |
b14 |
AC |
345 ms |
256 KB |
b15 |
AC |
388 ms |
256 KB |
b16 |
AC |
563 ms |
256 KB |
b17 |
AC |
383 ms |
256 KB |
b18 |
AC |
289 ms |
256 KB |
b19 |
AC |
303 ms |
256 KB |
b20 |
AC |
4 ms |
256 KB |
b21 |
AC |
53 ms |
256 KB |
b22 |
AC |
326 ms |
256 KB |
b23 |
AC |
238 ms |
256 KB |
b24 |
AC |
403 ms |
256 KB |