#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define str string
#define pb push_back
#define pf push_front
#define pob pop_back()
#define pof pop_front()
#define in insert
#define fi first
#define se second
#define size size()
#define begin begin()
#define end end()
#define back back()
#define front front()
#define rend rend()
#define rbegin rbegin()
#define ret return
#define ull unsigned long long
#define all(a) a.begin , a.end
#define gcd __gcd
#define lcm(a , b) (a * b) / gcd(a , b)
#define friopen freopen ("exercise.in", "r", stdin); freopen("exercise.out", "w", stdout);
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds;
const ll mod = 1e9 + 7 , mod2 = 998244353 , N = 5e5 , inf = 1e18;
const ld esp = 0.0000001 , Pi = 3.1415926535897932384626433832795;
void kol_a()
{
ll n , m , i , j;
cin >> n >> m;
deque<ll> ans;
ll a[n + 12] = {} , b[m + 12] = {};
for (i = 1 ; i <= n ; i ++) cin >> a[i];
for (i = 1 ; i <= m ; i ++)
{
ll lst = 0;
cin >> b[i];
if (i >= n)
{
for (j = 1 ; j <= n ; j ++)
{
ll x = b[i - n + a[j]];
if (x < lst) goto to;
lst = x;
}
ans.pb(i - n + 1);
to:;
}
}
cout << ans.size << '\n';
for (auto x : ans) cout << x << " ";
}
main()
{
// friopen
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll _ = 1;
// cin >> _;
while(_ --) kol_a();
}
/*
*/
Compilation message (stderr)
mat.cpp:76:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
76 | main()
| ^~~~
# | 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... |