Submission #843779

# Submission time Handle Problem Language Result Execution time Memory
843779 2023-09-04T14:49:51 Z zwezdinv Xoractive (IZhO19_xoractive) C++17
0 / 100
1 ms 344 KB
#include<bits/stdc++.h>
#include"interactive.h"

using namespace std;
#define all(x) x.begin(), x.end()
using ll = long long;

vector<int> guess(int n) {
    map<int, int> mp;
    int c0 = ask(1);
    mp[c0] = 1;
    for (int h = 0; h < 7; ++h) {
        vector<int> qq;
        for (int i = 2; i <= n; ++i) {
            if (i >> h & 1) qq.push_back(i);
        }
        if (qq.empty()) continue;
        map<int, int> mp1, mp2;
        {
            vector<int> vals = get_pairwise_xor(qq);
            for (auto i: vals) mp1[i]++;
            for (int i = 0; i < qq.size(); ++i) mp1[0]--;
            for (auto &[x, y]: mp1) y /= 2;
        }
        qq.push_back(1);
        {
            vector<int> vals = get_pairwise_xor(qq);
            for (auto i: vals) mp2[i]++;
            for (int i = 0; i < qq.size(); ++i) mp2[0]--;
            for (auto &[x, y]: mp2) y /= 2;
        }
        for (auto [x, y]: mp1) mp2[x] -= y;
        for (auto [x, y]: mp2) {
            if (y) {
                mp[x ^ c0] |= 1 << h;
            }
        }
        cout << endl;
    }
    vector<int> ans(n);
    for (auto [x, y]: mp) ans[y - 1] = x;
    return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:22:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |             for (int i = 0; i < qq.size(); ++i) mp1[0]--;
      |                             ~~^~~~~~~~~~~
Xoractive.cpp:29:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             for (int i = 0; i < qq.size(); ++i) mp2[0]--;
      |                             ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Failed 0 ms 344 KB do not print anything to standard output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -