#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();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
3028 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
3028 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
3028 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
3124 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
3028 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |