結果
| 問題 | 
                            No.1896 Arrays and XOR Procedure 2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             yamake
                         | 
                    
| 提出日時 | 2022-04-08 22:23:55 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,377 bytes | 
| コンパイル時間 | 1,474 ms | 
| コンパイル使用メモリ | 173,160 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-11-28 13:06:56 | 
| 合計ジャッジ時間 | 5,221 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 2 | 
| other | WA * 27 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define debug(output) if(debugFlag)cout<<#output<<"= "<<output<<"\n";
using lint = long long;
typedef pair<int,int> P;
const bool debugFlag=true;
const lint linf=1.1e18;const int inf=1.01e9;
constexpr int MOD=1000000007;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
signed main(){
  int n;cin>>n;
  vector<int> a(n),b(n);
  rep(i,n)cin>>a[i];
  rep(i,n)cin>>b[i];
  int f=max(*max_element(a.begin(),a.end()),*max_element(b.begin(),b.end()));
  while(f!=(f&(-f)))f-=(f&(-f));
  int ai=-1;int bi=-1;
  rep(i,n){
    if(a[i]&f)ai=i;
    if(b[i]&f)bi=i;
  }
  vector<array<int,3>> res;
  if(ai==-1){
    ai=0;
    a[0]^=b[bi];
    res.push_back({1,1,bi+1});
  }
  else{
    bi=0;
    b[0]^=a[ai];
    res.push_back({2,1,ai+1});
  }
  rep(i,n){
    if((a[i]&f)>0&&i!=ai){
      a[i]^=b[bi];
      res.push_back({1,i+1,bi+1});
    }
    if((b[i]&f)==0){
      b[i]^=a[ai];
      res.push_back({2,ai+1,i+1});
    }
  }
  a[ai]^=b[bi];
  res.push_back({1,ai+1,bi+1});
  cout<<res.size()<<"\n";
  rep(i,res.size()){
    rep(j,3)cout<<res[i][j]<<" ";
    cout<<"\n";
  }
  return 0;
}
            
            
            
        
            
yamake