QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#789295#8936. Team Arrangement_fcy_#WA 0ms3672kbC++141.1kb2024-11-27 19:48:552024-11-27 19:48:58

Judging History

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

  • [2024-11-27 19:48:58]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3672kb
  • [2024-11-27 19:48:55]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn=100+10;
vector <int> ver;
int inf=1e18;
int n,ans=-inf;
int vis[maxn],l[maxn],r[maxn],w[maxn];
void dfs(int x,int y){
    //cout<<x<<" "<<y<<" "<<n<<endl;
    if(x==0){
        vector <int> res(n+2,0);
        int val=0;
        for(auto u:ver){
            res[u]++;            
            val+=w[u];
        }
        int flag=1;
        for(int i=1;i<=n;i++){
            if(vis[i]<res[i]*i){
                flag=0; break;
            }
        }
        if(flag==1){
            ans=max(ans,val);
        }
        return;
    }
    for(int i=1;i<=min(x,y);i++){
        ver.push_back(i);
        dfs(x-i,i);
        ver.pop_back();
    }
}
signed main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>l[i]>>r[i];
        for(int j=l[i];j<=r[i];j++){
            vis[j]++;
        }
    }
    for(int i=1;i<=n;i++){
        cin>>w[i];
    }
    dfs(n,100);
    if(ans==-inf) cout<<"impossible\n";
    else cout<<ans<<"\n";
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3672kb

input:

3
2 3
1 2
2 2
4 5 100

output:

9

result:

ok single line: '9'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

3
1 3
3 3
2 3
1 1 100

output:

100

result:

ok single line: '100'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

2
1 1
2 2
1 1

output:

impossible

result:

ok single line: 'impossible'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

3
2 3
1 2
2 2
-100 -200 100000

output:

-300

result:

ok single line: '-300'

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3600kb

input:

9
1 4
2 5
3 4
1 5
1 1
2 5
3 5
1 3
1 1
1 1 1 1 1 1 1 1 1

output:

7

result:

wrong answer 1st lines differ - expected: '6', found: '7'