Submission #618709

#TimeUsernameProblemLanguageResultExecution timeMemory
618709Je_OXoractive (IZhO19_xoractive)C++17
100 / 100
6 ms468 KiB
#include "interactive.h" #include<bits/stdc++.h> #define fi first #define se second #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef pair<int, int> ii; const int N = 105; map<int, int> pos; map<int, int> cnt; vector<int> guess(int n){ vector<int> ans; for(int i = 0; i < n; ++i)ans.pb(0); ans[0] = ask(1); for(int i = 0; i <= 6; i++){ vector<int> v; for(int j = 2; j <= n; ++j){ if(j & (1 << i))v.pb(j); } if(v.size() == 0)continue; vector<int> v1 = get_pairwise_xor(v); v.pb(1); vector<int> v2 = get_pairwise_xor(v); cnt.clear(); for(int j = 0; j < v1.size(); ++j)cnt[v1[j]]--; for(int j = 0; j < v2.size(); ++j)cnt[v2[j]]++; for(auto it = cnt.begin(); it != cnt.end(); ++it){ if(it->se == 0 || it->fi == 0)continue; pos[(it->fi) ^ ans[0]] |= (1 << i); } } for(auto it = pos.begin(); it != pos.end(); ++it){ ans[it->se - 1] = it->fi; } return ans; }

Compilation message (stderr)

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |   for(int j = 0; j < v1.size(); ++j)cnt[v1[j]]--;
      |                  ~~^~~~~~~~~~~
Xoractive.cpp:30:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   for(int j = 0; j < v2.size(); ++j)cnt[v2[j]]++;
      |                  ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...