Submission #10379623


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 s=0; s < (1<<D); s++) {
        int solve = 0, score = 0;
        // 部分的に解きたい場合
        int partial = -1;

        // i番目の得点が同じ問題グループは全て解く
        for (int i=0; i<D; i++) {
            if (s & (1<<i)) {
                solve += p[i];
                score += 100 * (i+1) * p[i] + c[i];
            } else {
                /* こうすることで、最終的に部分的に解きたい問題のうち
                   得点が最大の問題のiがpartialに入る */
                partial = i;
            }
        }
        // 残スコア
        int less = G - score;
        if (less > 0) {
            // 部分的に解きたい問題の1問分の点数
            long long prob_score = 100*(partial + 1);
            if (less > prob_score*p[partial]) continue;
            solve += min(p[partial], less / prob_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 0
Code Size 1750 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:41:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&D);
                     ^
./Main.cpp:43:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&G);
                     ^
./Main.cpp:47:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&p[i]);
                            ^
./Main.cpp:48: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 0 / 300
Status
AC × 4
AC × 23
WA × 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 AC 1 ms 256 KB
b07 WA 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