제출 #465732

#제출 시각아이디문제언어결과실행 시간메모리
465732idasXor Sort (eJOI20_xorsort)C++11
25 / 100
11 ms1228 KiB
#include<bits/stdc++.h> #define FOR(i, begin, end) for(int i=(begin); i<(end); i++) #define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr) #define PB push_back #define F first #define S second const int INF=1e9; const long long LINF=1e18; using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; typedef map<int, int> mii; const int N=210; int n, a[N], s; vector<pii> ans; int main() { FAST_IO; cin >> n >> s; FOR(i, 0, n) cin >> a[i]; bool going=true; while(going){ going=false; FOR(i, 1, n) { if(a[i-1]>a[i]){ swap(a[i-1], a[i]); ans.PB({i, i+1}); ans.PB({i+1, i}); ans.PB({i, i+1}); going=true; } } } cout << ans.size() << '\n'; for(auto[x, y] : ans){ cout << x << " " << y << '\n'; } }

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

xorsort.cpp: In function 'int main()':
xorsort.cpp:43:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   43 |     for(auto[x, y] : ans){
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...