제출 #468850

#제출 시각아이디문제언어결과실행 시간메모리
468850mychecksedadXor Sort (eJOI20_xorsort)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(0); int n, s, arr[1010]; cin >> n >> s; for(int i = 1; i <= n; i++) cin >> arr[i]; vector<pair<int, int>> ans; if(s == 1){ }else{ for(int bit = 20; bit >= 0; bit--){ for(int i = 1; i < n; i++){ if((1<<bit)&arr[i]){ if((1<<bit)&(arr[i + 1])){ ans.pb({i+1, i}); ans.pb({i, i+1}); arr[i + 1] ^= (1<<bit); arr[i] ^= (1<<bit); }else{ ans.pb({i, i+1}); arr[i] ^= (1<<bit); } } } } } cout << ans.size() << '\n'; for(auto k: ans) cout << k.first << ' ' << k.second << '\n'; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

xorsort.cpp: In function 'int main()':
xorsort.cpp:17:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'pb'
   17 |       ans.pb({i+1, i});
      |           ^~
xorsort.cpp:18:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'pb'
   18 |       ans.pb({i, i+1});
      |           ^~
xorsort.cpp:22:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'pb'
   22 |       ans.pb({i, i+1});
      |           ^~