Submission #710081

#TimeUsernameProblemLanguageResultExecution timeMemory
710081safaricolaMoney (IZhO17_money)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back #define pi pair <int, int> #define pii pair <pi, int> #define rep(i,n) for(ll i = 1; i <= n; i++) #define fi first #define se second using namespace std; int n, a[1000010],mx,mi; bool vis[1000010]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin>>n; rep(i,n)cin>>a[i]; int ans=1; mx=a[n]; for(int i=n; i>1; i--){ if(a[i-1]>a[i]){ mx=a[i-1]; vis[mi]=true; vis[mx]=true; ans++; //cout<<1; }else{ mi=a[i-1]; if(a[i]!=a[i-1]+1&&!vis[mx-1]){ ans++; mx=a[i-1]; vis[mi]=true; vis[mx]=true; //cout<<2; }else if(a[i]!=a[i-1]+1&&!vis[mi+1]){ cout<<mi+1<<endl; rep(i,n)cout<<vis[i];cout<<endl; ans++; mx=a[i-1]; vis[mi]=true; vis[mx]=true; //cout<<3; } } mi=a[i-1]; //cout<<mi<<' '<<mx<<' '<<ans<<endl; } cout<<ans; }

Compilation message (stderr)

money.cpp: In function 'int main()':
money.cpp:6:18: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    6 | #define rep(i,n) for(ll i = 1; i <= n; i++)
      |                  ^~~
money.cpp:35:13: note: in expansion of macro 'rep'
   35 |             rep(i,n)cout<<vis[i];cout<<endl;
      |             ^~~
money.cpp:35:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   35 |             rep(i,n)cout<<vis[i];cout<<endl;
      |                                  ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...