fork(2) download
  1. ///*******************************THINK TWICE CODE ONCE*******************************///
  2. ///*******************************NO CODE NO FOOD*******************************///
  3. #define _USE_MATH_DEFINES
  4. #include <bits/stdc++.h>
  5. #define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
  6. #define loop(n) for(int i=0;i<n;i++)
  7. #define ll long long
  8. using namespace std;
  9. //int f[1001];
  10. //vector<int>a[100001];
  11. int dis[100001];
  12. //int ans(int )
  13. int main()
  14. {
  15. //freopen("team.in", "r", stdin);
  16. //freopen("output.txt","w",stdout);
  17. fast;
  18. int t;
  19. cin>>t;
  20. while(t--)
  21. {
  22.  
  23. int n;
  24. cin>>n;
  25. int a[n];
  26. int f[1001]={0};
  27. map<int,int>m;
  28. loop(n)
  29. {
  30. cin>>a[i];
  31. m[a[i]]=i;
  32. f[a[i]]=1;
  33. }
  34.  
  35. int mx=0;
  36. loop(1001)
  37. {
  38. for(int j=0;j<1001;j++)
  39. {
  40. if(f[i]==1&&f[j]==1)
  41. {
  42.  
  43. int c= __gcd(i,j);
  44. if(c==1)
  45. {
  46. //cout<<"a ";
  47. mx=max(mx,(m[i]+m[j]));
  48. }
  49.  
  50. }
  51. }
  52. }
  53. if(mx==0)
  54. cout<<-1<<endl;
  55. else
  56. cout<<mx+2<<endl;
  57. }
  58. return 0;
  59. }
  60.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:3: error: illegal character: '#'
#define _USE_MATH_DEFINES
^
Main.java:4: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:5: error: illegal character: '#'
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
^
Main.java:5: error: class, interface, or enum expected
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
                                         ^
Main.java:5: error: class, interface, or enum expected
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
                                                    ^
Main.java:6: error: illegal character: '#'
#define loop(n) for(int i=0;i<n;i++)
^
Main.java:6: error: class, interface, or enum expected
#define loop(n) for(int i=0;i<n;i++)
                            ^
Main.java:6: error: class, interface, or enum expected
#define loop(n) for(int i=0;i<n;i++)
                                ^
Main.java:7: error: illegal character: '#'
#define ll long long
^
Main.java:11: error: class, interface, or enum expected
int dis[100001];
^
Main.java:13: error: class, interface, or enum expected
int main()
^
Main.java:18: error: class, interface, or enum expected
    int t;
    ^
Main.java:19: error: class, interface, or enum expected
    cin>>t;
    ^
Main.java:20: error: class, interface, or enum expected
    while(t--)
    ^
Main.java:24: error: class, interface, or enum expected
 cin>>n;
 ^
Main.java:25: error: class, interface, or enum expected
 int a[n];
 ^
Main.java:26: error: class, interface, or enum expected
 int f[1001]={0};
 ^
Main.java:27: error: class, interface, or enum expected
 map<int,int>m;
 ^
Main.java:28: error: class, interface, or enum expected
 loop(n)
 ^
Main.java:31: error: class, interface, or enum expected
     m[a[i]]=i;
     ^
Main.java:32: error: class, interface, or enum expected
     f[a[i]]=1;
     ^
Main.java:33: error: class, interface, or enum expected
 }
 ^
Main.java:36: error: class, interface, or enum expected
 loop(1001)
 ^
Main.java:38: error: class, interface, or enum expected
     for(int j=0;j<1001;j++)
                 ^
Main.java:38: error: class, interface, or enum expected
     for(int j=0;j<1001;j++)
                        ^
Main.java:44: error: class, interface, or enum expected
            if(c==1)
            ^
Main.java:48: error: class, interface, or enum expected
            }
            ^
Main.java:55: error: class, interface, or enum expected
 else
 ^
Main.java:57: error: class, interface, or enum expected
    }
    ^
Main.java:59: error: class, interface, or enum expected
}
^
30 errors
stdout
Standard output is empty