Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
2.2 kB
8
Indexable
Never
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
#define ll long long 

int main() {
	#define int long long
	ll t=1;
	while(t--){
		map<int,pair<int,int> > mp;
        vector<int> v={0,4, 8, 15, 16, 23, 42};
        for(int i=1;i<=6;i++){
            for(int j=i+1;j<=6;j++){
                mp[v[i]*v[j]]=make_pair(i,j);
            }
        }
        int a1,a2;
        cout<<"? "<<1<<" "<<2<<endl;
        fflush(stdout);
        cin>>a1;
        cout<<"? "<<2<<" "<<3<<endl;
        fflush(stdout);
        cin>>a2;
        vector<int> ans(6);
        if(mp[a1].first==mp[a2].first || mp[a1].first==mp[a2].second)
        ans[1]=v[mp[a1].first];
        else
        ans[1]=v[mp[a1].second];
        ans[0]=a1/ans[1];
        ans[2]=a2/ans[1];
        cout<<"? "<<3<<" "<<4<<endl;
        fflush(stdout);
        cin>>a1;
        ans[3]=a1/ans[2];
        cout<<"? "<<4<<" "<<5<<endl;
        fflush(stdout);
        cin>>a1;
        ans[4]=a1/ans[3];
        ans[5]=4+8+15+16+23+42-ans[0]-ans[1]-ans[2]-ans[3]-ans[4];
        cout<<"! "<<ans[0]<<" "<<ans[1]<<" "<<ans[2]<<" "<<ans[3]<<" "<<ans[4]<<" "<<ans[5]<<endl;
        fflush(stdout);
	}
	return 0;
}