結果
問題 |
No.1896 Arrays and XOR Procedure 2
|
ユーザー |
![]() |
提出日時 | 2022-04-08 22:52:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,238 bytes |
コンパイル時間 | 1,876 ms |
コンパイル使用メモリ | 182,404 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-28 13:47:17 |
合計ジャッジ時間 | 5,564 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 1 WA * 26 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll,ll>; #define rep(i, n) for(ll i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;} int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; priority_queue<P> a; priority_queue<P,vector<P>,greater<P>> b; rep(i,n){ ll x; cin >> x; a.push({x,i+1}); } rep(i,n){ ll x; cin >> x; b.push({x,i+1}); } vector<vector<ll>> ans; int cnt = 0; vector<ll> sub(3); while(a.top().first>=b.top().first){ cnt++; ll p,q,r,s; tie(p,q) = a.top(); tie(r,s) = b.top(); ll x = p^s; if(x>p){ sub = {2,q,r}; b.pop(); b.push({x,r}); }else{ sub = {1,q,r}; a.pop(); a.push({x,q}); } ans.push_back(sub); } cout << cnt << '\n'; rep(i,cnt){ rep(j,3) cout << ans[i][j] << " "; cout << '\n'; } while(cnt>10000) cnt++; return 0; }