Submission #90875

#TimeUsernameProblemLanguageResultExecution timeMemory
90875YottaByteCrazy old lady (IZhO13_crazy)C++14
0 / 100
2 ms376 KiB
#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 (stderr)

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