This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
int main() {
int f, k, m;
vector<pair<int, int>> fish;
cin >> f >> k >> m;
for (int i = 0; i < f; ++i) {
int a, b;
cin >> a >> b;
fish.push_back(make_pair(a, b));
}
multiset<int> alright;
sort(fish.begin(), fish.end());
set<multiset<int>> s;
set<pair<int, multiset<int>>> take;
s.insert(alright);
take.insert(make_pair(0, alright));
long long count = 0;
for (auto i : fish) {
for (auto k = take.begin(); k != take.end(); ++k) {
auto j = *k;
if (i.first >= 2 * j.first) {
j.second.insert(i.second);
if (s.count(j.second) == 0) {
s.insert(j.second);
take.insert(make_pair(i.first, j.second));
++count;
count %= m;
}
}
}
}
cout << (count % m);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |