# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
889436 |
2023-12-19T16:43:14 Z |
codefox |
Sirni (COCI17_sirni) |
C++14 |
|
3063 ms |
786436 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
int main()
{
int n;
cin >> n;
vector<int> nums(n);
set<pii> num;
for(int i = 0; i < n; i++)
{
cin >> nums[i];
num.insert({nums[i], i});
}
sort(nums.begin(), nums.end());
set<int> mult;
for (int j = nums[0]; j <=1e7; j+=nums[0])
{
mult.insert(j);
}
ll sol = 0;
priority_queue<pii, vector<pii>, greater<pii>> pq;
pq.push({0,0});
for(int i = 1; i < n; i++) pq.push({nums[i], nums[i]});
vector<bool> vis(n, 0);
while (pq.size())
{
int i, d;
tie(d, i) = pq.top();
pq.pop();
if (vis[i]) continue;
vis[i] = true;
num.erase({nums[i], i});
for (int j = nums[i]; j <=1e7; j+=nums[i])
{
auto u = num.lower_bound({j, 0});
if (u != num.end()) pq.push({(*u).first-j, (*u).second});
}
sol+=d;
}
cout << sol;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
856 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1556 ms |
786432 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
860 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2215 ms |
786432 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1479 ms |
786432 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3063 ms |
786432 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1967 ms |
786432 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2166 ms |
786432 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2354 ms |
786432 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1501 ms |
786436 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |