Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #ifndef ACMTUYO
  6. #define cin lala
  7. ifstream cin;
  8. #define cout coco
  9. ofstream coco;
  10. #endif
  11.  
  12. typedef long long int ll;
  13.  
  14. int main() {
  15. #ifndef ACMTUYO
  16. cin = ifstream("injurious.in");
  17. cout = ofstream("injurious.out");
  18. #endif
  19. int n;
  20. cin>>n;
  21. vector <set<int> > v(1000000);
  22. vector <int> v1;
  23.  
  24. for(int i=0;i<n;i++){
  25. int a;
  26. cin>>a;
  27.  
  28. v[a].insert(i);
  29. v1.push_back(a);
  30. }
  31.  
  32. for(int i=0;i<n;i++){
  33. for(int j=i+1;j<n;j++){
  34.  
  35. int r=2*v1[j]-v1[i];
  36. if(r<0){
  37. continue;
  38. }
  39. set <int>::iterator it;
  40. it=v[r].upper_bound(j);
  41.  
  42. if(it!=v[r].end()){
  43. cout<<"Yes"<<endl;
  44. cout<<i<<" "<<j<<" "<<*it<<endl;
  45. return 0;
  46. }
  47. }
  48.  
  49. }
  50. cout<<"No"<<endl;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement