Submission #1592290
Source Code Expand
int main(){ int n; cin>>n; int p[100001]={0}; int ans=0; for (int i=1; i<=n; i++) { cin>>p[i]; } for (int i=1; i<=n; i++) { if(p[i]==i){ swap(p[i], p[i+1]); ans++; } } cout<<ans<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | kiharaf |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 300 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:3:5: error: ‘cin’ was not declared in this scope cin>>n; ^ ./Main.cpp:11:30: error: ‘swap’ was not declared in this scope swap(p[i], p[i+1]); ^ ./Main.cpp:15:5: error: ‘cout’ was not declared in this scope cout<<ans<<endl; ^ ./Main.cpp:15:16: error: ‘endl’ was not declared in this scope cout<<ans<<endl; ^