이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#pragma GCC optimize("unroll-loops")
*/
#include <bits/stdc++.h>
#define taskname "bai3"
#define int long long
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'
#define pii pair<int, int>
using namespace std;
const int mxN = 1e6 + 5;
const int mod = 1e9 + 7;
const int oo = 1e18;
int n, m, sx[mxN], a[mxN];
void solve(){
cin >> n >> m;
for(int i = 1; i <= n; ++i) cin >> sx[i];
for(int i = 1; i <= m; ++i) cin >> a[i];
vector<int> v;
for(int i = 1; i <= m - n + 1; ++i){
int lst = 0;
bool flag = false;
for(int j = i; j < i + n; ++j){
int tmp = a[sx[j - i + 1] + i - 1];
if(tmp < lst){
flag = true;
break;
}
else lst = tmp;
}
if(!flag) v.pb(i);
}
cout << v.size() << endl;
for(int tmp : v){
cout << tmp << " ";
}
cout << endl;
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
//freopen(taskname".inp", "r", stdin);
//freopen(taskname".out", "w", stdout);
int t = 1; //cin >> t;
while(t--) solve();
}
# | 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... |