結果
問題 |
No.1589 Bit Vector
|
ユーザー |
![]() |
提出日時 | 2024-08-08 16:31:02 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 930 bytes |
コンパイル時間 | 1,415 ms |
コンパイル使用メモリ | 100,556 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-08-08 16:31:11 |
合計ジャッジ時間 | 8,800 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 35 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> using namespace std; using ll = long long; int cnt = 0; vector<string> ans; void and1(int i,int j,int k){ ans.push_back("AND "+to_string(i)+" "+to_string(j)+" "+to_string(k)); } void xor1(int i,int j,int k){ ans.push_back("XOR "+to_string(i)+" "+to_string(j)+" "+to_string(k)); } void upd(int i,int x){ ans.push_back("AND "+to_string(i)+" "+to_string(x)); } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n,k; cin>>n>>k; for(int i = 0;i<n-1;i++){ for(int j = n-1;j>i;j--){ int ni = j-1; int nj = j; xor1(n,ni,nj); xor1(nj,n,nj); xor1(ni,ni,nj); and1(n,nj,n); xor1(nj,nj,n); } } upd(n,1); for(int i = 0;i<k;i++) and1(n,i,n); cout<<ans.size()<<endl; for(int i = 0;i<ans.size();i++) cout<<ans[i]<<endl; }