結果
問題 | No.1896 Arrays and XOR Procedure 2 |
ユーザー |
|
提出日時 | 2022-04-28 12:30:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 1,449 bytes |
コンパイル時間 | 1,684 ms |
コンパイル使用メモリ | 176,272 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-28 07:54:18 |
合計ジャッジ時間 | 5,300 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
/*made in mrd*/ #include<bits/stdc++.h> using namespace std; const int N=2e5+10; #define endl '\n' #define int long long #define mem(a,b) memset(a,b,sizeof a) #define fi first #define se second #define lu u<<1 #define ru u<<1|1 #define pb push_back #define bug1(x) cout<<x<<endl #define bug2(x,y) cout<<x<<' '<<y<<endl #define pii pair<int,int> #define bug3(x,y,z) cout<<x<<' '<<y<<' '<<z<<endl void init() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int n; int a[N]; int b[N]; struct node{ int a,b,c; }; vector<node>ans; priority_queue<pii>q,p; signed main() { init(); int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; q.push({a[i],i}); } for(int i=1;i<=n;i++){ cin>>b[i]; p.push({-b[i],i}); } int t=100; while(1) { auto x=q.top(); q.pop(); auto y=p.top(); p.pop(); int x1=x.fi; int y1=-y.fi; //cout<<x1<<" "<<y1<<endl; if(x1<y1) break; int z=(x1^y1); if(z<x1){ //cout<<z<<endl; //cout<<q.top().fi<<endl; q.push({z,x.se}); p.push({-y1,y.se}); ans.pb({1,x.se,y.se}); } else { q.push({x1,x.se}); p.push({-z,y.se}); ans.pb({2, x.se, y.se}); } } cout<<ans.size()<<endl; for(auto i:ans){ cout<<i.a<<" "<<i.b<<" "<<i.c<<endl; } return 0; }