QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#89523#5252. DeforestationFengfengWA 14ms3492kbC++14498b2023-03-20 13:14:212023-03-20 13:14:23

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-20 13:14:23]
  • 评测
  • 测评结果:WA
  • 用时:14ms
  • 内存:3492kb
  • [2023-03-20 13:14:21]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

long long w;
long long ans=0;

long long dfs()
{
	int n;
	long long no;
	cin>>no>>n;
	long long sum=0;
	priority_queue<int>q;
	for(int i=1;i<=n;i++)
	{
		long long t=dfs();
		q.push(t);
		sum+=t;
	}
	while(sum>w)
	{
		ans++;
		sum-=q.top();
	}
	if(sum) ans++;
	ans+=no/w;
	no%=w;
	return no;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>w;
	if(dfs()) ans++;
	cout<<ans;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 14ms
memory: 3492kb

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:

36958

result:

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