| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1333082 | aaaaaaaa | Money (IZhO17_money) | C++20 | 0 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n, ans = 0;
cin >> n;
vector<int> a(n, 0), srt;
for(int i = 0; i < n; ++i){
cin >> a[i];
}
map<int, int> mp;
set<int> st;
vector<int> dp(n + 5, 0);
for(int z = 0; z < n; ++z){
st.insert(a[z]);
mp[a[z]] += 1;
map<int, int> cur;
int small = -1;
for(auto it : st){
cur[it] = small;
small = it;
}
dp[z] = 1;
for(int j = z - 1; j >= 0; --j){
if(a[j] != a[j + 1] && cur[a[j + 1]] != a[j]){
dp[z] = dp[j] + 1;
break;
}
}
}
cout << dp[n - 1] << "\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... | ||||
