fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n,t,a[3000],c,ans;
  7. for(cin >> t;t--;) {
  8. cin >> n;
  9. for(int i=0;i<n;++i)
  10. cin >> a[i];
  11. c = 0;
  12. ans = -1;
  13. for(int i = 1; i < n; ++i)
  14. if(a[i-1] + 1 == a[i]) {
  15. cout << "=";
  16. c++;
  17.  
  18. }
  19. else {
  20. cout << "_";
  21. ans = max(ans, c);
  22. c = 0;
  23. }
  24. cout << endl;
  25. cout << ans + 1 << endl;
  26. }
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5316KB
stdin
6
1
4
5
0 1 1 2 3
2
1 1
4
4 2 3 6
5
2 4 1 0 -1
6
-1 1 2 3 5 6
stdout
0
=_==
2
_
1
_=_
2
____
1
_==_=
3