Submission #504011

# Submission time Handle Problem Language Result Execution time Memory
504011 2022-01-09T13:10:06 Z lukameladze Xoractive (IZhO19_xoractive) C++14
0 / 100
2 ms 680 KB
#include "interactive.h"
# include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
using namespace std;
const int N = 3e5 + 5;
vector <int> v;
int numb,idx[N];
map <int, int> fix;
multiset <int> ms;
vector <int> guess(int n) {
    vector <int> ans = vector <int> (n, 0);
    vector <int> num; num.clear();
	ans[0] = ask(1);
    for (int i = 0;; i++) {
        v.clear();
        for (int j = 1; j < n; j++) {
            if ((1<<i) & j) v.pb(j + 1);
        }
        if (!v.size()) break;ms.clear();
        vector <int> v1 = get_pairwise_xor(v); v.pb(1);
        vector <int> v2 = get_pairwise_xor(v);
        for (int i = 0; i < v2.size(); i++) {
            ms.insert(v2[i]);
        }
		ms.erase(ms.find(0));
        for (int i = 0; i < v1.size(); i++) {
            ms.erase(ms.find(v1[i]));
        } 
        for (auto it = ms.begin(); it != ms.end(); it++) {
            numb = (*it);
            
            numb ^= ans[0];
            if (!fix[numb]) {
                num.pb(numb); fix[numb] = 1;
            }
            idx[numb] += (1<<i);
            it++;
        }
    }
    for (int i = 0; i < num.size(); i++) {
        numb = num[i]; ans[idx[numb]] = numb;
    }
   
    return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:21:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   21 |         if (!v.size()) break;ms.clear();
      |         ^~
Xoractive.cpp:21:30: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   21 |         if (!v.size()) break;ms.clear();
      |                              ^~
Xoractive.cpp:24:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         for (int i = 0; i < v2.size(); i++) {
      |                         ~~^~~~~~~~~~~
Xoractive.cpp:28:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         for (int i = 0; i < v1.size(); i++) {
      |                         ~~^~~~~~~~~~~
Xoractive.cpp:42:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for (int i = 0; i < num.size(); i++) {
      |                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 404 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 680 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -