Submission #102700

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1027002019-03-27 02:32:56bert30702Werewolf (IOI18_werewolf)C++17
100 / 100
2834 ms165872 KiB
#include <bits/stdc++.h>
#include "werewolf.h"
using namespace std;
const int MX = 2e5 + 100;
vector<int> G[MX], G_mx[MX], G_mn[MX];
int boss_mx[MX], boss_mn[MX];
int l_mx[MX], r_mx[MX], l_mn[MX], r_mn[MX], tmp[MX];
vector<int> ptr_mn[MX], ptr_mx[MX];
vector<int> T[MX * 4];
void build_ptr_mn(int u, int p, int &ptr) {
l_mn[u] = ++ptr;
tmp[ptr] = u;
if(p != -1) {
ptr_mn[u].push_back(p);
while(ptr_mn[ptr_mn[u].back()].size() >= ptr_mn[u].size()) {
ptr_mn[u].push_back(ptr_mn[ptr_mn[u].back()][ptr_mn[u].size() - 1]);
}
}
for(auto it: G_mn[u]) build_ptr_mn(it, u, ptr);
r_mn[u] = ptr;
}
void build_ptr_mx(int u, int p, int &ptr) {
l_mx[u] = ++ptr;
if(p != -1) {
ptr_mx[u].push_back(p);
while(ptr_mx[ptr_mx[u].back()].size() >= ptr_mx[u].size()) {
ptr_mx[u].push_back(ptr_mx[ptr_mx[u].back()][ptr_mx[u].size() - 1]);
}
}
for(auto it: G_mx[u]) build_ptr_mx(it, u, ptr);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

werewolf.cpp: In function 'void build_T(int, int, int)':
werewolf.cpp:35:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int m = l + r >> 1;
          ~~^~~
werewolf.cpp: In function 'int query_T(int, int, int, int, int, int, int)':
werewolf.cpp:43:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int m = l + r >> 1;
          ~~^~~
werewolf.cpp: In function 'std::vector<int> query(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:50:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < S.size(); i ++) {
                 ~~^~~~~~~~~~
werewolf.cpp: In function 'std::vector<int> check_validity(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:73:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < X.size(); i ++) {
                 ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...