Submission #3423463
Source Code Expand
#include <iostream> #include <cmath> #include <string> #include <algorithm> #include <set> #include <vector> #include <map> #include <list> #include <stack> #include <cstdio> #include <cstring> #include <cstdlib> #include <queue> #define pye cout << "yes" << endl #define pno cout << "no" << endl #define pYe cout << "Yes" << endl #define pNo cout << "No" << endl #define pYE cout << "YES" << endl #define pNO cout << "NO" << endl #define prin(num) cout << num << endl #define max(a, b) ((a)>(b) ? (a):(b)) #define min(a, b) ((a)<(b) ? (a):(b)) #define INF 1000000000000000000 #define MOD 1000000007LL #define MAX 30005 #define BLACK 0 #define WHITE 1 using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef map<ll, ll> Map; int main(void) { ll D, G; ll p[10], c[10]; ll i, j; ll ans=INF; cin >> D >> G; for(i=1; i<=D; i++) { cin >> p[i] >> c[i]; } for(i=0; i<1<<D; i++) { ll tmp=0; ll score=0; for(j=1; j<=D; j++) { if(1&i>>(j-1)) { tmp+=p[j]; score+=p[j]*100*j+c[j]; } } if(score>=G) { ans=min(ans, tmp); }else { for(j=D; j>=1; j--) { if(1&i>>(j-1)) continue; ll rem_sco=G-score; ll rem_cnt=(rem_sco+100*j-1)/(100*j); if(rem_cnt>=p[j]) continue; ans=min(ans, tmp+rem_cnt); } } } prin(ans); }
Submission Info
Submission Time | |
---|---|
Task | C - All Green |
User | eQe |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1618 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 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 | 1 ms | 256 KB |
b07 | AC | 1 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 | 1 ms | 256 KB |
b13 | AC | 1 ms | 256 KB |
b14 | AC | 1 ms | 256 KB |
b15 | AC | 1 ms | 256 KB |
b16 | AC | 1 ms | 256 KB |
b17 | AC | 1 ms | 256 KB |
b18 | AC | 1 ms | 256 KB |
b19 | AC | 1 ms | 256 KB |
b20 | AC | 1 ms | 256 KB |
b21 | AC | 1 ms | 256 KB |
b22 | AC | 1 ms | 256 KB |
b23 | AC | 1 ms | 256 KB |
b24 | AC | 1 ms | 256 KB |