Submission #261839

#TimeUsernameProblemLanguageResultExecution timeMemory
261839yabsedWerewolf (IOI18_werewolf)C++17
15 / 100
4057 ms23928 KiB
#include "werewolf.h" #include <bits/stdc++.h> using namespace std; int ok[3][200555]; vector <int> v[200555]; int f(int N, int s, int e, int l, int r){ queue <int> q; memset(ok, 0, sizeof(ok)); if(l<=s){ ok[1][s]=1; q.push(1); q.push(s); } if(e<=r){ ok[0][e]=1; q.push(0); q.push(e); } while(!q.empty()){ int type=q.front(); q.pop(); int x=q.front(); q.pop(); //rintf("%d %d\n", type, x); for(int i=0;i<v[x].size();i++){ if(type==0){ if(v[x][i]<=r&&ok[type][v[x][i]]==0){ ok[type][v[x][i]]=1; q.push(type); q.push(v[x][i]); } } else{ if(l<=v[x][i]&&ok[type][v[x][i]]==0){ ok[type][v[x][i]]=1; q.push(type); q.push(v[x][i]); } } } } for(int i=0;i<N;i++) if(ok[0][i]&&ok[1][i])return 1; return 0; } vector<int> check_validity(int N, std::vector<int> X, std::vector<int> Y, std::vector<int> S, std::vector<int> E, std::vector<int> L, std::vector<int> R) { int Q = S.size(); for(int i=0;i<X.size();i++){ v[X[i]].push_back(Y[i]); v[Y[i]].push_back(X[i]); } vector<int> A(Q); for (int i = 0; i < Q; ++i) { A[i] = f(N, S[i], E[i], L[i], R[i]); } return A; }

Compilation message (stderr)

werewolf.cpp: In function 'int f(int, int, int, int, int)':
werewolf.cpp:24:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<v[x].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:49:18: 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...