Submission #10380502


Source Code Expand

#include <bits/stdc++.h>
using namespace std;


void solve(long long D, long long G, std::vector<long long> p, std::vector<long long> c){
    int ans = 1e9;

    // bit全探索
    for (int i=0; i<(1<<D); i++) {
        int solve = 0, score = 0;
        int partial = -1;
        // それぞれのbitをチェックする
        for (int j=0; j<D; j++) {
            if (i & (1<<j)) {
                solve += p[j];
                score += 100 * (j + 1) * p[j] + c[j];
            } else {
                partial = j;
            }
        }

        long long less = G - score;
        if (less > 0) {
            int part_score = 100 * (partial + 1);
            if (less > part_score * p[partial]) continue;
            solve += min(p[partial], (less + (part_score-1)) / part_score);
        }
        ans = min(ans, solve);
    }
    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 1396 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:36:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&D);
                     ^
./Main.cpp:38:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&G);
                     ^
./Main.cpp:42:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&p[i]);
                            ^
./Main.cpp:43: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 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