結果
| 問題 |
No.1589 Bit Vector
|
| コンテスト | |
| ユーザー |
momoyuu
|
| 提出日時 | 2024-08-08 16:35:28 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 902 bytes |
| コンパイル時間 | 1,350 ms |
| コンパイル使用メモリ | 100,848 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-08-08 16:35:32 |
| 合計ジャッジ時間 | 3,541 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 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("UPD "+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);
and1(n,nj,n);
xor1(ni,ni,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;
}
momoyuu