# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
938470 | vjudge1 | Matching (CEOI11_mat) | C++17 | 2059 ms | 27368 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 <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
int n, m, a[1<<20], b[1<<20];
int z[1<<20], zn;
int main()
{
scanf("%d", &n);
scanf("%d", &m);
for (int i = 1; i <= n; ++i) scanf("%d", a+i);
for (int i = 1; i <= m; ++i) scanf("%d", b+i);
for (int i = 1; i + n - 1 <= m; ++i)
{
vector<pair<int, int> > v;
for (int j = i; j < i + n; ++j)
v.emplace_back(b[j], j);
sort(v.begin(), v.end());
int ok = 1;
for (int j = 1; j <= n; ++j)
if (v[j-1].second == a[j]+i-1);
else ok = 0;
if(ok)z [zn++] = i;
}
printf("%d\n", zn);
for (int i = 0; i < zn; ++i) printf("%d ", z[i]);
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |