제출 #1128071

#제출 시각아이디문제언어결과실행 시간메모리
1128071alikhanMoney (IZhO17_money)C++20
0 / 100
1 ms324 KiB
#include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC target("avx2") #define forn for(int i=1;i<=n;i++) #define Yes cout<<"YES\n" #define No cout<<"NO\n" #define YES cout<<"YES\n" #define NO cout<<"NO\n" #define pb push_back #define sp setprecision #define int long long #define ll long long #define nn '\n' using namespace std; const int N=1e6+10; int a[N]; const int MOD=1e9+7; string ab="abcdefghijklmnopqrstuvwxyz"; int binpow(int n, int k) { int ans = 1; while (k > 0) { if (k % 2 == 1) { ans = (ans * n) % MOD; } n = (n * n) % MOD; k /= 2; } return ans; } int sumofnum(int x) { int sum=0; while (x>1) { sum+=x%10; x/=10; } return sum; } //vector <int> g[N]; void al(){ int n; cin>>n; int cnt=0; int x=0; int mn=n; int mnx=1e9; int mxn=0; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=n;i++){ if(a[i]>a[i+1]) cnt++; } bool ok=1; for(int i=1;i<=n;i++){ if(a[i]!=i) ok=0; } mn=min(mn,cnt); if(ok) cout<<0; else cout<<mn; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int t=1; // cin>>t; while(t--) { al(); } } /* 2 2 2 3 3 1 1 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...