UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#212555#3841. 小t做晚餐(dinner)xiangjy5036ms1544kbC++2.0kb2024-10-19 11:10:322024-10-19 12:35:10

answer

#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
using namespace std;
/*
\\\\ \\ \\ \\ \\ \\ \\ \\ || || || || || || // // // // // // // ////
\\\\ \\ \\ \\ \\ \\ \\        _ooOoo_          // // // // // // ////
\\\\ \\ \\ \\ \\ \\          o8888888o            // // // // // ////
\\\\ \\ \\ \\ \\             88" . "88               // // // // ////
\\\\ \\ \\ \\                (| -_- |)                  // // // ////
\\\\ \\ \\                   O\  =  /O                     // // ////
\\\\ \\                   ____/`---'\____                     // ////
\\\\                    .'  \\|     |//  `.                      ////
//==                   /  \\|||  :  |||//  \                     ==\\
//==                  /  _||||| -:- |||||-  \                    ==\\
//==                  |   | \\\  -  /// |   |                    ==\\
//==                  | \_|  ''\---/''  |   |                    ==\\
//==                  \  .-\__  `-`  ___/-. /                    ==\\
//==                ___`. .'  /--.--\  `. . ___                  ==\\
//==             ."" '<  `.___\_<|>_/___.'  >' "".               ==\\
//==            | | :  `- \`.;`\ _ /`;.`/ - ` : | |              \\\\
////            \  \ `-.   \_ __\ /__ _/   .-` /  /              \\\\
////      ========`-.____`-.___\_____/___.-`____.-'========      \\\\
////                           `=---='                           \\\\
//// //   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  \\ \\\\
//// // //      佛祖保佑      永无BUG      永不修改        \\ \\ \\\\
//// // // // // // || || || || || || || || || || \\ \\ \\ \\ \\ \\\\
*/
int a[100010];
int n,m,t;
bool check(int x) {
	int sum=0;
	for(int i=1; i<=m; i++) {
		sum+=(x-a[i])/t;
	}
	return sum>=n;
}
int main(){
	scanf("%d%d%d",&n,&m,&t);
	for(int i=1; i<=m; i++) {
		scanf("%d",&a[i]);
	}
	int l=1,r=1e9,ans=0;
	while(l<=r) {
		int mid=(l+r)/2;
		if(check(mid)) {
			ans=mid;
			r=mid-1;
		} else {
			l=mid+1;
		}
	}
	printf("%d",ans);
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1184kb

input:

8 9 7
1 3 4 10 10 8 1 4 10

output:

15

result:

ok single line: '15'

Test #2:

score: 10
Accepted
time: 0ms
memory: 1188kb

input:

10 2 7
6 6

output:

41

result:

ok single line: '41'

Test #3:

score: 10
Accepted
time: 0ms
memory: 1188kb

input:

10 6 2
6 5 4 7 6 10

output:

10

result:

ok single line: '10'

Test #4:

score: 10
Accepted
time: 0ms
memory: 1188kb

input:

100 21 15
62 25 1 81 79 58 24 99 15 46 63 10 11 50 19 91 56 44 56 86 35

output:

126

result:

ok single line: '126'

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 1188kb

input:

1000 68 6
11 41 86 66 92 38 15 35 77 26 21 93 35 70 36 27 77 10 46 11 17 15 35 89 14 43 74 9 59 20 3...

output:

378967847

result:

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

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 1188kb

input:

1000 810 61
79 18 56 21 64 2 45 73 12 47 67 90 60 98 40 49 17 98 24 16 50 16 43 20 80 50 98 97 36 70...

output:

646896467

result:

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

Test #7:

score: 10
Accepted
time: 0ms
memory: 1200kb

input:

10000 3146 835
42 158 869 163 386 261 223 592 157 477 641 470 641 496 382 414 730 645 733 427 748 28...

output:

3520

result:

ok single line: '3520'

Test #8:

score: 0
Wrong Answer
time: 16ms
memory: 1544kb

input:

100000 93141 512
699 243 200 81 172 634 186 351 534 913 48 347 943 921 355 35 281 280 522 460 521 84...

output:

495803240

result:

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

Test #9:

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

input:

100000 80683 950
489 86 596 849 602 25 938 983 516 677 795 933 382 603 890 33 289 23 875 42 190 124 ...

output:

758566957

result:

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

Test #10:

score: 0
Wrong Answer
time: 6ms
memory: 1316kb

input:

100000 32895 1
289 623 217 574 424 341 24 490 391 721 351 621 331 350 676 962 676 684 442 940 117 54...

output:

259826766

result:

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