답안 #486038

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
486038 2021-11-10T12:09:07 Z Ronin13 Xoractive (IZhO19_xoractive) C++14
0 / 100
6 ms 840 KB
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define pb push_back
#include "interactive.h"
using namespace std;

vector<int> guess(int n) {
	vector <int> ans(n);
	ans[n-1]=ask(n);
	set<int>st[7];
	for(int pos=0;pos<=6;pos++){
        vector<int>a;
        for(int j=0;j<n-1;j++){
            if(j&(1<<pos))continue;
            else a.pb(j+1);
        }
        int len=a.size();
        vector<int>vec=get_pairwise_xor(a);
        multiset<int>x,y;
        for(int j=len;j<vec.size();j+=2)x.insert(vec[j]);
        a.pb(n);
        vector<int>vec1=get_pairwise_xor(a);
        for(int j=len+1;j<vec1.size();j+=2)y.insert(vec1[j]);
        for(int to:x){
            y.erase(y.find(to));
        }
        for(int to:y){
            st[pos].insert(to^ans[n-1]);
        }
	}
	for(int i=0;i<n-1;i++){
        vector<int>vec;
        for(int j=0;j<=6;j++){
            if(i&(1<<j))continue;
            vec.pb(j);
        }
        for(int to:st[vec[0]]){
            bool indic=true;
            for(int j=1;j<vec.size();j++){
                int ind=vec[j];
                if(st[ind].find(to)==st[ind].end()){
                    indic=false;
                    break;
                }
            }
            if(indic){
                ans[i]=to;
                for(int j=0;j<vec.size();j++){
                    int ind=vec[j];
                    st[ind].erase(st[ind].find(ans[i]));
                }
            }
        }
	}
	return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:21:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         for(int j=len;j<vec.size();j+=2)x.insert(vec[j]);
      |                       ~^~~~~~~~~~~
Xoractive.cpp:24:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         for(int j=len+1;j<vec1.size();j+=2)y.insert(vec1[j]);
      |                         ~^~~~~~~~~~~~
Xoractive.cpp:40:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |             for(int j=1;j<vec.size();j++){
      |                         ~^~~~~~~~~~~
Xoractive.cpp:49:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |                 for(int j=0;j<vec.size();j++){
      |                             ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 840 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -