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;
const int nax = 3e4 + 5;
vector<pair<int, int>> doges[nax];
set<int> s[nax];
bool visited[nax];
vector<int> edges[nax];
void solve () {
int n, m;
cin >> n >> m;
for (int i = 0; i < m; ++i) {
int b, p;
cin >> b >> p;
doges[b].push_back({i, p});
s[b].insert(p);
}
for (int i = 0; i < n; ++i) {
auto it = s[i].begin();
while (it != s[i].end()) {
int x = *it;
for (int j = i + x; j < n; j += x) {
edges[j - x].push_back(j);
s[j].erase(x);
}
it = s[i].erase(it);
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
solve();
}
# | 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... |