Submission #90968

#TimeUsernameProblemLanguageResultExecution timeMemory
90968kylych03Crazy old lady (IZhO13_crazy)C++14
0 / 100
2 ms500 KiB
#include <bits/stdc++.h> #define int long long #define sc second #define fr first int a[100001]; using namespace std; main() { int t,n,i,res; cin>>t; while(t--){ cin>>n; bool f=true; res=n; for(i=1;i<=n;i++){ cin>>a[i]; if(a[i]!=i){ f=false; res=min(a[i],res); } } if(n==1) cout<<1<<endl; else if(n==2 || f){ cout<<0<<endl; } else cout<<res<<endl; } }

Compilation message (stderr)

crazy.cpp:8:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...