QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#544994#9129. Quotient Sumqwqwf#WA 1ms5752kbC++14679b2024-09-02 21:32:172024-09-02 21:32:17

Judging History

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

  • [2024-09-26 15:38:30]
  • hack成功,自动添加数据
  • (/hack/908)
  • [2024-09-02 21:32:17]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5752kb
  • [2024-09-02 21:32:17]
  • 提交

answer

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
//#pragma GCC optimize("Ofast","unroll-loops","inline")
#include<bits/stdc++.h>
#define ll long long
#define int ll
#define pb push_back
#define pii pair<int,int>
#define MP make_pair
#define fi first
#define se second
using namespace std;
const int N=5e5+10,M=1e6+10,mod=998244353;
int n,a[N],f[N];
signed main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+n+1);
	f[1]=0;
	for(int i=2,j=1;i<=n;i++){
		while(j+1<i&&a[i]/a[j+1]+f[j+1]<=a[i]/a[j]+f[j]) j++;
		f[i]=a[i]/a[j]+f[j];
	}
	cout<<f[n]<<'\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5688kb

input:

3
2 3 6

output:

3

result:

ok "3"

Test #2:

score: 0
Accepted
time: 1ms
memory: 5560kb

input:

2
15 4

output:

3

result:

ok "3"

Test #3:

score: 0
Accepted
time: 1ms
memory: 5688kb

input:

9
284791808 107902 13660981249408 4622332661 13405199 24590921 361 244448137 16077087227955422

output:

4580

result:

ok "4580"

Test #4:

score: 0
Accepted
time: 1ms
memory: 5592kb

input:

9
12 9 5 17 2 6 7 1 15

output:

6

result:

ok "6"

Test #5:

score: 0
Accepted
time: 1ms
memory: 5696kb

input:

10
19 13 18 11 20 16 6 8 17 3

output:

4

result:

ok "4"

Test #6:

score: 0
Accepted
time: 1ms
memory: 5660kb

input:

8
5 7 11 16 2 15 1 20

output:

7

result:

ok "7"

Test #7:

score: 0
Accepted
time: 1ms
memory: 5732kb

input:

10
13 2 19 11 15 9 16 5 12 1

output:

7

result:

ok "7"

Test #8:

score: 0
Accepted
time: 1ms
memory: 5752kb

input:

8
9 1 14 11 3 12 8 20

output:

7

result:

ok "7"

Test #9:

score: 0
Accepted
time: 0ms
memory: 5672kb

input:

4
4 6 20 3

output:

5

result:

ok "5"

Test #10:

score: 0
Accepted
time: 1ms
memory: 5688kb

input:

382
1495 1297 1197 976 1335 486 1850 992 1483 1269 1898 1593 237 1342 711 957 1992 1401 1413 206 917 1831 1444 698 1291 1987 231 1559 1119 1822 1790 471 736 496 1157 1886 1974 699 1702 321 325 758 683 1826 1051 95 632 456 1224 1590 1394 1854 1226 1963 1926 1819 989 34 980 371 535 807 1541 144 433 12...

output:

11

result:

ok "11"

Test #11:

score: 0
Accepted
time: 0ms
memory: 5668kb

input:

317
1565 1374 387 1215 766 1670 862 673 1391 70 727 152 182 26 1111 1430 64 1318 349 994 780 1762 1993 552 715 1943 967 972 1039 646 617 1822 373 486 1863 1179 1840 1781 1963 220 773 671 126 613 719 1660 334 1851 65 707 1862 490 1466 1590 1717 1723 656 1526 1138 31 1976 1823 1335 1719 397 612 593 13...

output:

8

result:

ok "8"

Test #12:

score: -100
Wrong Answer
time: 0ms
memory: 5748kb

input:

100
1070 947 7 1735 476 1172 995 2000 536 15 1499 656 1810 1435 639 1647 61 630 4 754 1594 442 1644 1743 5 629 1879 1707 1174 1984 1526 1829 1449 783 1483 1734 1032 494 537 1872 1117 1316 1069 780 520 689 31 1970 1653 1071 251 360 1063 988 1154 638 547 525 264 495 273 436 967 633 462 1863 164 402 18...

output:

13

result:

wrong answer 1st words differ - expected: '12', found: '13'