Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c158d7e

Browse files
accepted
1 parent 52c5d16 commit c158d7e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <iostream>
2+
#include <vector>
3+
4+
using namespace std;
5+
6+
int main() {
7+
int n, c, t, qtd = 0;
8+
cin >> n >> c;
9+
vector<int>v(c+1, 0);
10+
for (int i = 0; i < n; i++) {
11+
cin >> t;
12+
v[t]++;
13+
}
14+
15+
while(true) {
16+
bool cant = false;
17+
for (int i = 1; i < c+1; i++) {
18+
v[i]-=1;
19+
if (v[i] < 0) {
20+
cant = true;
21+
break;
22+
}
23+
}
24+
if (cant)
25+
break;
26+
qtd++;
27+
}
28+
cout << qtd << endl;
29+
return 0;
30+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /