# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
481716 |
2021-10-21T13:08:47 Z |
Johann |
Sirni (COCI17_sirni) |
C++14 |
|
5000 ms |
1100 KB |
// https://oj.uz/problem/view/COCI17_sirni
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vb vector<bool>
int main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n;
cin >> n;
vi cards(n);
for (int i = 0; i < n; i++) {
cin >> cards[i];
}
sort(cards.begin(), cards.end());
int next = 0, curr = 0;
vb visited(n, false);
ll total = 0;
vi dists(n, INT_MAX);
for (int i = 0; i < n-1; i++) {
curr = next;
next = 0;
visited[curr] = true;
int current_value = cards[curr];
for (int v = 0; v < curr; v++) {
if (visited[v]) continue;
dists[v] = min(dists[v], current_value % cards[v]);
if (dists[v] < dists[next]) next = v;
}
for (int v = curr+1; v < n; v++) {
if (visited[v]) continue;
dists[v] = min(dists[v], cards[v] & current_value);
if (dists[v] < dists[next]) next = v;
}
total += (ll) dists[next];
}
cout << total << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5058 ms |
1092 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
349 ms |
404 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5094 ms |
1100 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1818 ms |
732 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5081 ms |
1100 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5088 ms |
1100 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
818 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |