3 条题解

  • 1
    @ 2025-2-15 10:31:25
    #include <iostream>
    #include <vector>
    using namespace std;
    vector<int> vec = {0};
    int main(){
       int n , m , tmp;
       cin >> n >> m;
       while(n--){
          cin >> tmp;
          vec.push_back(tmp);
       }
       int u , v;
       while(m--){
          cin >> u >> v;
          swap(vec[u] , vec[v]);
       }
       vec.erase(vec.begin());
       for(int x : vec){
          cout << x << " ";
       }
    
    
    
       return 0;
    }
    

    信息

    ID
    397
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    递交数
    20
    已通过
    8
    上传者