QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#89285 | #5252. Deforestation | buns_out | WA | 43ms | 3684kb | C++14 | 1.1kb | 2023-03-19 15:42:51 | 2023-03-19 15:42:55 |
Judging History
answer
/*
嵌套变量重复
特殊样例 0 1 2 n
数组越界
开long long
*/
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pp(x) array<int,x>
using ull=unsigned long long;
using ll=long long;
using pii=pair<int,int>;
const int dx[]={0,0,1,-1,1,-1,1,-1};
const int dy[]={1,-1,0,0,1,-1,-1,1};
const int mod=998244353;
const int inf=0x3f3f3f3f;
const int INF=1e9+7;
const int maxn=1e6+100;
int w,ans;
int dfs()
{
int len,n;
cin>>len>>n;
vector<int>v;
for(int i=1;i<=n;i++)
{
int x=dfs();
v.push_back(x);
}
sort(v.begin(),v.end());
int now=0;
for(auto i:v)
{
if(now+i<=w)now+=i;
else
{
ans++;
now=i;
}
}
len+=now;
ans+=len/w;
return len%w;
}
void solve()
{
cin>>w;
int x=dfs();
if(x)ans++;
cout<<ans<<endl;
}
signed main(){
// freopen("C:\\Users\\tob\\Desktop\\P1000_0.in.txt","r",stdin);
// freopen("C:\\Users\\tob\\Desktop\\P1000_0.out.txt","w",stdout);
// ios::sync_with_stdio(false);
// cin.tie(nullptr);cout.tie(nullptr);
// int __;cin>>__;
// while(__--)
solve();
// fclose(stdin);
// fclose(stdout);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 43ms
memory: 3448kb
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: 27ms
memory: 3684kb
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'