| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1333029 | aaaaaaaa | Money (IZhO17_money) | C++20 | 0 ms | 348 KiB |
#include <bits/stdc++.h>
using namespace std;
const int mxN = 501 * 501;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n + 1, 0), vc(n, 0), pos(n + 5, 0);
for(int i = 1; i <= n; ++i){
cin >> a[i];
}
for(int i = 0; i < n; ++i){
vc[i] = pos[i + 1] = i + 1;
}
int i = n, ans = 0;
while(1){
int oi = i;
set<int> st = {a[i]};
for(int j = i - 1; j >= 1; --j){
if(pos[a[j + 1]] != pos[a[j]] + 1){
i = j;
break;
}else{
st.insert(a[j]);
}
}
int l = i + 1, r = i;
vector<int> nvc;
for(int i = 0; i <= n; ++i) pos[i] = -5;
for(int j = 0; j < (int) vc.size(); ++j){
if(st.find(vc[j]) == st.end()){
nvc.push_back(vc[j]);
pos[nvc.back()] = (int) nvc.size() - 1;
}
}
ans += 1;
if(nvc.size() == 0) break;
swap(vc, nvc);
if(ans > 10) break;
}
cout << ans << "\n";
return 0;
}
| # | 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... | ||||
