fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3.  
  4. using namespace std;
  5.  
  6. const int MOD = 1e9 + 7;
  7.  
  8. void solve(){
  9.  
  10. int n;
  11. cin >> n;
  12. vector<int> a(n);
  13.  
  14. for(int i = 0; i < n; i++)cin >> a[i];
  15.  
  16. for(int i = 1; i < n; i++){
  17. if(a[i] == a[i - 1]){
  18. cout << a[i - 2] << "\n";
  19. cout << i << "\n";
  20. cout << a[i] << " " << a[i - 1] << "\n";
  21. cout << -1 << "\n";
  22. return;
  23. }
  24. if(i > 1){
  25. if(a[i] >= a[i - 1] && a[i - 1] >= a[i - 2]){
  26. cout << a[i] << " " << a[i - 1] << " " << a[i - 2] << "\n";
  27. cout << -1 << "\n";
  28. return;
  29. }
  30. if(a[i] <= a[i - 1] && a[i - 1] <= a[i - 2]){
  31. cout << a[i] << " " << a[i - 1] << " " << a[i - 2] << "\n";
  32. cout << -1 << "\n";
  33. return;
  34. }
  35. }
  36. }
  37. cout << 1 << "\n";
  38.  
  39. }
  40.  
  41. int main(){
  42. ios_base::sync_with_stdio(false);
  43. cin.tie(nullptr);
  44.  
  45. int t = 1;
  46. cin >> t;
  47.  
  48. for(int i = 1; i <= t; i++){
  49. solve();
  50. }
  51. return 0;
  52. }
Success #stdin #stdout 0s 5280KB
stdin
1
582
103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 99 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 100 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 101 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 102 103 104 103 104 103 104 103 104 103 104 103 104 103 104 103 104 103 104 103 104 103 104 103 104 103 104 103 104 103 104 103 104 103 104 ...
stdout
104 103 102
-1