結果
問題 | No.2819 Binary Binary-Operator |
ユーザー | FplusFplusF |
提出日時 | 2024-06-03 20:03:50 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 23 ms / 2,000 ms |
コード長 | 1,923 bytes |
コンパイル時間 | 3,455 ms |
コンパイル使用メモリ | 264,160 KB |
実行使用メモリ | 25,452 KB |
平均クエリ数 | 3.00 |
最終ジャッジ日時 | 2024-07-26 15:45:46 |
合計ジャッジ時間 | 7,025 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 64 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair<ll,ll>; using tll=tuple<ll,ll,ll>; using ld=long double; const ll INF=(1ll<<60); #define rep(i,n) for (ll i=0;i<(ll)(n);i++) #define replr(i,l,r) for (ll i=(ll)(l);i<(ll)(r);i++) #define all(v) v.begin(),v.end() #define len(v) ((ll)v.size()) template<class T> inline bool chmin(T &a,T b){ if(a>b){ a=b; return true; } return false; } template<class T> inline bool chmax(T &a,T b){ if(a<b){ a=b; return true; } return false; } int main(){ ios::sync_with_stdio(false); ll l,r; cin >> l >> r; ll sz=4; rep(i,1<<sz){ vector<ll> now(sz,0); rep(j,sz){ if(i&(1<<j)) now[j]=1; } vector<set<ll>> st(2); rep(a,2){ rep(b,2){ rep(c,2){ rep(d,2){ map<pll,ll> mp; mp[{0,0}]=a; mp[{0,1}]=b; mp[{1,0}]=c; mp[{1,1}]=d; ll k=now[0]; for(ll j=1;j<sz;j++){ k=mp[{k,now[j]}]; } if(l==0&&r==0) st[a].insert(k); if(l==0&&r==1) st[b].insert(k); if(l==1&&r==0) st[c].insert(k); if(l==1&&r==1) st[d].insert(k); } } } } if(len(st[0])==1&&len(st[1])==1&&*begin(st[0])!=*begin(st[1])){ cout << sz << '\n'; rep(j,sz) cout << now[j] << ' '; cout << '\n'; cout.flush(); ll res; cin >> res; if(st[0].contains(res)) cout << "0\n"; else cout << "1\n"; cout.flush(); } } }