QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#293941 | #5252. Deforestation | LaStataleBlue# | WA | 11ms | 3692kb | C++23 | 968b | 2023-12-30 00:14:12 | 2023-12-30 00:14:12 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int w,ans=0;
int calc(){
int m,n;
cin>>m>>n;
pair<int,int> best = {INT_MAX,0};
vector<int> v;
for(int i=0;i<n;i++){
v.push_back(calc());
}
for(int j=0;j<2;j++){
int sum=0;
int curr=0;
for(int i=0;i<n;i++){
int x= v[i];
if(sum+x<=w)sum+=x;
else{
curr++;
sum=x;
}
}
sum+=m;
curr+=sum/w;
sum%=w;
best=min(best,{curr,sum});
reverse(v.begin(),v.end());
}
ans+=best.first;
return best.second;
}
void solve(){
cin>>w;
if(calc()>0)ans++;
cout<<ans<<"\n";
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 11ms
memory: 3488kb
input:
999900000 7339 3 14947 2 12850 3 8986 10 11599 9 8889 10 10711 4 8015 1 11626 0 9492 1 7017 0 8863 0 8632 0 5321 5 9906 0 11687 0 9845 0 10469 0 11708 0 14950 5 11934 0 11922 0 13101 0 12000 0 9082 0 9273 5 12296 0 6119 0 9201 0 12652 0 12957 0 7454 5 12515 0 12976 0 10358 0 13997 0 8371 0 10181 5 8...
output:
1
result:
ok single line: '1'
Test #2:
score: -100
Wrong Answer
time: 7ms
memory: 3692kb
input:
2 1 99999 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ...
output:
50000
result:
wrong answer 1st lines differ - expected: '99999', found: '50000'