제출 #787379

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
7873792023-07-19 06:37:05boyliguanhanWerewolf (IOI18_werewolf)C++17
100 / 100
1808 ms272768 KiB
#include "werewolf.h"
#define pb push_back
#define VI vector<int>
#include<bits/stdc++.h>
using namespace std;
#define MXN 400100
struct node{
int l,r,val,lc,rc;
node():l(0){}
node(int l, int r, int val, int lc, int rc):l(l),r(r),val(val),lc(lc),rc(rc){}
node(int pos):l(pos),r(pos),val(1){}
} t[15*MXN];
int cnt;
int query(int i, int l, int r) {
if(!t[i].val||t[i].l>r||t[i].r<l)return 0;
if(l<=t[i].l&&t[i].r<=r) return t[i].val;
return query(t[i].lc,l,r)+query(t[i].rc,l,r);
}
int mn(int a, int b) {
t[++cnt] = node(t[a].l,t[b].r,t[a].val+t[b].val,a,b);
return cnt;
}
int upd(int i, int pos) {
if(t[i].l==t[i].r) {
t[++cnt] = node(pos);
return cnt;
}
if(pos<t[t[i].rc].l)
return mn(upd(t[i].lc,pos),t[i].rc);
return mn(t[i].lc, upd(t[i].rc, pos));
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

werewolf.cpp: In function 'int build(int, int)':
werewolf.cpp:34:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   34 |     return mn(build(l,l+r>>1),build(l+r+2>>1,r));
      |                       ~^~
werewolf.cpp:34:40: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   34 |     return mn(build(l,l+r>>1),build(l+r+2>>1,r));
      |                                     ~~~^~
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:56:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |     for(int i = 0; i < X.size(); i++) {
      |                    ~~^~~~~~~~~~
werewolf.cpp:95:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   95 |     for(int i = 0; i < s.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...