結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー mrd-Tmrd-T
提出日時 2022-04-28 12:30:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 1,449 bytes
コンパイル時間 1,680 ms
コンパイル使用メモリ 173,540 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-10 16:48:04
合計ジャッジ時間 7,805 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 4 ms
4,376 KB
testcase_05 AC 6 ms
4,380 KB
testcase_06 AC 4 ms
4,376 KB
testcase_07 AC 4 ms
4,376 KB
testcase_08 AC 4 ms
4,376 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 4 ms
4,376 KB
testcase_13 AC 4 ms
4,376 KB
testcase_14 AC 4 ms
4,376 KB
testcase_15 AC 3 ms
4,376 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 3 ms
4,376 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 4 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 4 ms
4,376 KB
testcase_23 AC 4 ms
4,380 KB
testcase_24 AC 4 ms
4,376 KB
testcase_25 AC 4 ms
4,376 KB
testcase_26 AC 5 ms
4,376 KB
testcase_27 AC 5 ms
4,380 KB
testcase_28 AC 3 ms
4,376 KB
testcase_29 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*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;
}
0