YauhenMardan

Untitled

May 29th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. #include <fstream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. typedef std::pair<int, long long> _pair;
  6.  
  7. int main(int argc, const char * argv[]) {
  8. std::ifstream fin("input.txt");
  9. std::ofstream fout("output.txt");
  10. auto compG = []( _pair a, _pair b ) {
  11. if(a.second==b.second){
  12. return a.first > b.first;
  13. } else{
  14. return a.second < b.second;
  15. }
  16. };
  17. int n=0,m;
  18. fin>>m;
  19. //works
  20. std::vector<int> workers(m);
  21. std::vector<_pair> works;
  22. std::vector<int> amount(m);
  23. //read works
  24. long long t_val;
  25. while(!fin.eof()){
  26. fin>>t_val;
  27. n++;
  28. works.push_back(std::make_pair(n, t_val));
  29. }
  30. //algo
  31. std::sort(works.begin(), works.end(), compG);
  32. std::reverse(works.begin(), works.end());
  33. std::vector<int> minId;
  34. int minam = 10000000;
  35. fout<<"\n";
  36. return 0;
  37. }
Add Comment
Please, Sign In to add comment