Submission #90875

# Submission time Handle Problem Language Result Execution time Memory
90875 2018-12-25T05:01:17 Z YottaByte Crazy old lady (IZhO13_crazy) C++14
0 / 100
2 ms 376 KB
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define int long long

main()
{
	int t;
	cin >> t;
	while(t--)
	{
		int n, p, last;
		int ans = 0; cin >> n;
		for(int i = 1; i <= n; i++)
		{
			cin >> p;
			if(p == i) ans = last;
			last = p;
		}
		cout << ans << endl;
	}
}
/**

2
2 2 1
4 2 3 1 4

**/

Compilation message

crazy.cpp:12:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -