QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#540720 | #8936. Team Arrangement | ucup-team3282# | WA | 0ms | 3608kb | C++20 | 1.3kb | 2024-08-31 17:44:50 | 2024-08-31 17:44:51 |
Judging History
answer
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
pair<int,int>mp[65];
long long ans=-1e18;
long long w[65];
int stk[61];
int n;
long long check(){
// for(int i=1;i<=n;i++){
// for(int j=1;j<=stk[i];j++){
// cout<<i<<",";
// }
// }
// cout<<endl;
int nw=1;
long long cnt=0;
for(int i=1;i<=n;i++){
for(int j=1;j<=stk[i];j++){
int cp=i;
while(cp){
// cout<<"<"<<nw<<">";
if(mp[nw].first<=i&&mp[nw].second>=i){
cp--;nw++;
}else{
// cout<<i<<":"<<"NO\n";
return -1e18;
}
}
}
cnt+=w[i]*stk[i];
}
// cout<<"YES\n";
return cnt;
}
void dfs(int step,int cnt){
if(cnt>n)return;
if(step==n+1){
stk[1]=n-cnt;
ans=max(ans,check());
return;
}
for(int i=0;i<=n;i++){
stk[step]=i;
dfs(step+1,cnt+i*step);
}
return;
}
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>mp[i].first>>mp[i].second;
}
sort(mp+1,mp+n+1);
for(int i=1;i<=n;i++)cin>>w[i];
dfs(2,0);
cout<<ans<<endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3592kb
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: 3608kb
input:
3 1 3 3 3 2 3 1 1 100
output:
100
result:
ok single line: '100'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3496kb
input:
2 1 1 2 2 1 1
output:
-1000000000000000000
result:
wrong answer 1st lines differ - expected: 'impossible', found: '-1000000000000000000'