Submission #643442

#TimeUsernameProblemLanguageResultExecution timeMemory
643442CDuongMatching (CEOI11_mat)C++14
63 / 100
2079 ms10224 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...