Submission #10380642


Source Code Expand

#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
using namespace std;


void solve(long long D, long long G, std::vector<long long> p, std::vector<long long> c){
    vector<int> v(D);
    iota(all(v), 0);

    int ans = 1e9;
    while (true) {
        int solve = 0, score = 0;
        for (auto i: v) {
            int plus_score = 100*(i+1)*p[i] + c[i]; 
            if (score + plus_score <= G) {
                solve += p[i];
                score += plus_score;
            } else {
                int less = G - score;
                long long part_score = 100 * (i + 1);
                if (less > 0) solve += min(p[i], (less+(part_score-1))/part_score);
                break;
            }
        }
        ans = min(ans, solve);
        if (!next_permutation(all(v))) break;
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long D;
    scanf("%lld",&D);
    long long G;
    scanf("%lld",&G);
    std::vector<long long> p(D);
    std::vector<long long> c(D);
    for(int i = 0 ; i < D ; i++){
        scanf("%lld",&p[i]);
        scanf("%lld",&c[i]);
    }
    solve(D, G, std::move(p), std::move(c));
    return 0;
}

Submission Info

Submission Time
Task C - All Green
User NixieSquid
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1363 Byte
Status AC
Exec Time 110 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:34:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&D);
                     ^
./Main.cpp:36:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&G);
                     ^
./Main.cpp:40:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&p[i]);
                            ^
./Main.cpp:41:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&c[i]);
                            ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 24
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 72 ms 256 KB
b07 AC 64 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 2 ms 256 KB
b13 AC 9 ms 256 KB
b14 AC 86 ms 256 KB
b15 AC 90 ms 256 KB
b16 AC 110 ms 256 KB
b17 AC 90 ms 256 KB
b18 AC 81 ms 256 KB
b19 AC 83 ms 256 KB
b20 AC 2 ms 256 KB
b21 AC 12 ms 256 KB
b22 AC 85 ms 256 KB
b23 AC 77 ms 256 KB
b24 AC 92 ms 256 KB