-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdemo.cpp
33 lines (32 loc) · 920 Bytes
/
demo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<bits/stdc++.h>
using namespace std;
int minimumSize(vector<int>& nums, int maxOperations) {
//init priority queue max heap
priority_queue<int, vector<int>, greater<int>> pq;
for(auto x:nums){
pq.push(x);
}
while(maxOperations--){
int k=pq.top();
int div=2;
while(k%div==0){
div++;
}
pq.pop();
pq.push(k/div);
pq.push(k-(k/div));
}
return pq.top();
}
int main() {
int n;
vector<int>nums;
}
// problem_links = [
// "https://codeforces.com/problemset/problem/2047/A",
// "https://codeforces.com/problemset/problem/2042/B",
// "https://codeforces.com/problemset/problem/2042/A",
// "https://codeforces.com/problemset/problem/2039/B",
// "https://codeforces.com/problemset/problem/2039/A",
// # Add more links here
// ]