# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
999679 | AMel0n | September (APIO24_september) | C++17 | 1 ms | 348 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 "september.h"
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(a) for(int i=0;i<a;++i)
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define node S[i][j]
int solve(int N, int M, std::vector<int> P, std::vector<std::vector<int>> S) {
vector<pi> ranges(N, pi(-1,-1));
rep(M) {
for(int j=0; j<N - 1; ++j) {
if (ranges[node].first == -1) {
ranges[node].first = j;
} else if (ranges[node].second == -1) {
ranges[node].second = j;
} else if (ranges[node].second < j) {
ranges[node].second = j;
}
}
}
sort(ranges.begin(), ranges.end());
int res = 0, l = 0, r = 0, i = 0;
while (l < N - 1){
while (i < ranges.size() && ranges[i].first <= r){
r = max(r, ranges[i].second); i++;
}
res++;
l = r + 1; r++;
}
return res;
}
Compilation message (stderr)
# | 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... |