/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag,
tree_order_statistics_node_update> ordered_[1]t;
//// order_of_key(k) : ���������� ���������� ���������, ������� ������ ������
������ �������� k �� ����� O(logn).
//// find_by_order(k) : ���������� �������� � k-�� �������� (������ �� ����) �
������ �� ����� O(logn).
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define str string
#define ld long double
#define fi first
#define pb push_back
#define pf push_front
#define se second
#define all(a) a.begin(), a.end()
#define run_vasya_run ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define ull unsigned long long
#define open freopen("help.in", "r", stdin);
#define close freopen("help.out", "w", stdout);
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update>order_set;
const ll mod = 1e9 + 7;
const ll N = 5e5;
const int MAXN = 2e5+10;
ll binpow(ll a, ll n)
{
if (n < 1)
{
return 1;
}
if (n == 1)
{
return a;
}
ll b = binpow(a, n / 2);
b = (b * b) % mod;
if (n % 2 == 1)
{
b = (b * a) % mod;
}
return b % mod;
}
/*
ll c(ll n, ll k)
{
if(n < k)
{
return 0;
}
return (fact[n] * binpow((fact[k] * fact[n - k]) % mod, mod - 2)) % mod;
}
Почему здесь это ограничение? Как бы изменилась задача, если бы его здесь не
было? Что необычного? Что задача требует от меня сделать? Могу ли я
переформулировать ее как некую стандартную зада
Proverit kod na minimalniy test
Proverit asimptotiku
ne zabit proverit ogranicheniya na problem
KKKKKKKKKKKKKKKKKHHHHHHHHHHHHHAAAAAAAATTTTTTTTTTOOOOOOOOOOOOGGGGGGGGGGGGGGGGIIIIIIIIIIIIIIII
*/
////order_of_key(x) находит кол во элементов меньше x
main()
{
run_vasya_run;
ll _;
_ = 1;
//cin >> _;
while(_ --)
{
int n , m;
cin >> n >> m;
int answer , cnt;
int a[n + 18] , b[m + 18];
for(int i = 1;i <= n;i ++){
cin >> a[i];
}
for(int j = 1;j <= m;j ++){
cin >> b[j];
}
answer = 0;
vector<int>vec;
for(int i = 1;i <= m - n + 1;i ++){
cnt = 0;
for(int j = 1;j < n;j ++){
if(b[i + a[j] - 1] < b[i + a[j + 1] - 1]){
cnt ++;
}
else{
break;
}
}
if(cnt == n - 1){
vec.push_back(i);
}
}
cout << vec.size() << endl;
for(auto to : vec){
cout << to << ' ';
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
mat.cpp:72:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
72 | 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... |