# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
465815 | 2021-08-16T19:11:15 Z | daisy | Xor Sort (eJOI20_xorsort) | C++17 | 8 ms | 1016 KB |
#include<iostream> #include<vector> #define endl '\n' using namespace std; pair<int,int> m[1005]; vector< pair<int,int> > v; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,s; cin>>n>>s; for(int i=1;i<=n;i++){ cin>>m[i].first; m[i].second=i; } for(int i=1;i<=(1<<20);i*=2) { for(int j=1;j<n;j++) { if((i&m[j].first)) { if(!(i&m[j+1].first)) { v.push_back({j+1,j}); m[j+1].first^=m[j].first; } v.push_back({j,j+1}); m[j].first^=m[j+1].first; } } } cout<<v.size()<<endl; for(int i=0;i<v.size();i++) { cout<<v[i].first<<" "<<v[i].second<<endl; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 332 KB | Not sorted |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 332 KB | Not sorted |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 2 ms | 460 KB | Output is correct |
5 | Correct | 6 ms | 848 KB | Output is correct |
6 | Correct | 6 ms | 848 KB | Output is correct |
7 | Correct | 6 ms | 848 KB | Output is correct |
8 | Correct | 6 ms | 848 KB | Output is correct |
9 | Correct | 6 ms | 832 KB | Output is correct |
10 | Correct | 6 ms | 848 KB | Output is correct |
11 | Correct | 6 ms | 920 KB | Output is correct |
12 | Correct | 6 ms | 848 KB | Output is correct |
13 | Correct | 6 ms | 836 KB | Output is correct |
14 | Correct | 6 ms | 872 KB | Output is correct |
15 | Correct | 8 ms | 1016 KB | Output is correct |