QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#667441#7159. CandyWarinchai_s#0 0ms3764kbC++141.0kb2024-10-22 23:03:452024-10-22 23:03:56

Judging History

你现在查看的是最新测评结果

  • [2024-10-22 23:03:56]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3764kb
  • [2024-10-22 23:03:45]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
int ar[105];
int dp[105][105];
vector<pair<int,int>>v;
map<int,int>mp[105];
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,f,t;cin>>n>>f>>t;
    int cnt=0;
    int aans=0;
    for(int i=0;i<n;i++){
        cin>>ar[i];
        if(ar[i]==1){
            cnt++;
            if(cnt<=t){
                aans+=(i-cnt+1);
            }
        }
    }
    int ans=LLONG_MAX;
    if(cnt<t){
        cout<<"NO\n";
        return 0;
    }else{
        cout<<aans<<"\n";
    }

    for(int i=0;i<(1<<n);i++){
        int x=__builtin_popcount(i);
        if(x!=f)continue;
        vector<int>v;
        int sum=0;
        for(int j=0;j<n;j++){
            if((i>>j)&1)v.push_back(j),sum+=ar[j];
        }
        if(sum<t)continue;
        int tans=0;
        for(int j=0;j<f;j++){
            tans+=v[j]-j;
        }
        ans=min(ans,tans);
    }
    if(ans==LLONG_MAX)cout<<"NO\n";
    else cout<<ans<<"\n";
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3764kb

input:

1 1 7
7

output:

NO

result:

wrong answer 1st lines differ - expected: '0', found: 'NO'

Subtask #2:

score: 0
Wrong Answer

Test #9:

score: 0
Wrong Answer
time: 0ms
memory: 3604kb

input:

100 50 50
1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

1805
NO

result:

wrong output format Extra information in the output file

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%