Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <vector>
- #include <algorithm>
- typedef std::pair<int, long long> _pair;
- int main(int argc, const char * argv[]) {
- std::ifstream fin("input.txt");
- std::ofstream fout("output.txt");
- auto compG = []( _pair a, _pair b ) {
- if(a.second==b.second){
- return a.first > b.first;
- } else{
- return a.second < b.second;
- }
- };
- int n=0,m;
- fin>>m;
- //works
- std::vector<int> workers(m);
- std::vector<_pair> works;
- std::vector<int> amount(m);
- //read works
- long long t_val;
- while(!fin.eof()){
- fin>>t_val;
- n++;
- works.push_back(std::make_pair(n, t_val));
- }
- //algo
- std::sort(works.begin(), works.end(), compG);
- std::reverse(works.begin(), works.end());
- std::vector<int> minId;
- int minam = 10000000;
- fout<<"\n";
- return 0;
- }
Add Comment
Please, Sign In to add comment