fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define pb push_back
  4. #define MOD 1000000007
  5. #define PI 4 * atan(1)
  6. #define sz(A) (int)A.size()
  7. typedef long long ll;
  8. typedef vector<int> vi;
  9. typedef pair<int, int> pii;
  10. typedef vector<long long> vll;
  11. typedef long int int32;
  12. typedef unsigned long int uint32;
  13. typedef long long int int64;
  14. typedef unsigned long long int uint64;
  15.  
  16. inline void solve(int test){
  17. set<int> s;
  18. int n; cin >> n;
  19. int a[n];
  20. for(int i=0; i<n; i++){
  21. cin >> a[i];
  22. s.insert(a[i]);
  23. }
  24. if(s.size() == n && is_sorted(a, a+n)) cout << "1\n";
  25. else cout << "0\n";
  26. }
  27. int main(){
  28. ios_base::sync_with_stdio(false);
  29. cin.tie(NULL);
  30. cout.tie(NULL);
  31. int typetest = 1;
  32. if (typetest){
  33. int t;
  34. cin >> t;
  35. cin.ignore();
  36. for(int i=1; i<=t; i++){
  37. solve(i);
  38. }
  39. }
  40. else solve(0);
  41. }
Success #stdin #stdout 0.01s 5312KB
stdin
Standard input is empty
stdout
Standard output is empty