algorithms

Algorithm implementations
git clone git://git.laack.co/algorithms.git
Log | Files | Refs | README

main.cpp (663B)


      1 #include <vector>
      2 #include <unordered_map>
      3 #include <iostream>
      4 using namespace std;
      5 int main() {
      6     int testCases, x,y,n, current;
      7     cin >> testCases;
      8 
      9     for(int z = 0; z < testCases; ++z) {
     10 
     11         cin >> n;
     12         cin >> x;
     13         cin >> y;
     14 
     15         vector<int> ls {};
     16         for(int i = 0; i < n; ++i) {
     17             if(i == x || i == y) {
     18                 ls.push_back(-1);
     19             }
     20             cin >> current;
     21             ls.push_back(current);
     22         }
     23         if(x == n || y == n) {
     24             ls.push_back(-1);
     25         }
     26         for(int i = 0; i < ls.size(); ++i) {
     27             cout << ls[i] << " ";
     28         }
     29         cout << endl;
     30     }
     31 
     32 }