제출 #519843

#제출 시각아이디문제언어결과실행 시간메모리
519843Dasha_GnedkoXoractive (IZhO19_xoractive)C++17
100 / 100
5 ms456 KiB
#include "interactive.h"

#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define sz(a) int32_t(a.size())

using namespace std;

vector < int > guess(int n)
{
	vector < int > a(n);
	a[0] = ask(1);
	if (n == 1) return a;
	map < int, int > zn;
	for(int j = 0; j < 7; j++)
    {
        vector < int > b;
        for(int i = 1; i < n; i++)
            if (i & (1 << j)) b.pb(i + 1);
        if (sz(b) == 0) continue;
        vector < int > ve = get_pairwise_xor(b);
        b.pb(1);
        vector < int > ve2 = get_pairwise_xor(b);
        b.pop_back();
        map < int, int > mp;
        for(auto to: ve2)
            mp[to]++;
        for(auto to: ve)
            mp[to]--;
        mp[0]--;
        for(auto to: mp)
            if (to.S) zn[to.F] += (1 << j);
    }
	for(auto to: zn)
        a[to.S] = to.F;
    for(int i = 1; i < n; i++)
        a[i] ^= a[0];
	return a;
}

컴파일 시 표준 에러 (stderr) 메시지

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:38:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   38 |     for(int i = 1; i < n; i++)
      |     ^~~
Xoractive.cpp:40:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   40 |  return a;
      |  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...