# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
110977 | square1001 | Jakarta Skyscrapers (APIO15_skyscraper) | C++14 | 1056 ms | 154512 KiB |
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 <set>
#include <deque>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_map>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> B(M), P(M);
for(int i = 0; i < M; ++i) {
cin >> B[i] >> P[i];
}
int sum = 0;
set<pair<int, int> > s;
for(int i = 0; i < M; ++i) {
pair<int, int> u = make_pair(B[i] % P[i], P[i]);
if(s.find(u) == s.end()) {
sum += ((N - 1) - B[i] % P[i] + P[i]) / P[i];
s.insert(u);
}
}
vector<vector<int> > G(N + sum);
unordered_map<int, int> d;
int cnt = N;
for(pair<int, int> i : s) {
for(int j = i.first; j < N; j += i.second) {
d[i.second * N + j] = cnt;
G[cnt].push_back(j);
# | 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... |