結果
問題 |
No.1589 Bit Vector
|
ユーザー |
![]() |
提出日時 | 2024-08-08 16:29:11 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 928 bytes |
コンパイル時間 | 1,277 ms |
コンパイル使用メモリ | 100,684 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-08-08 16:29:19 |
合計ジャッジ時間 | 8,305 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 = n-1;i>0;i--){ for(int j = i;j>0;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; }