제출 #261835

#제출 시각아이디문제언어결과실행 시간메모리
261835yabsed늑대인간 (IOI18_werewolf)C++17
0 / 100
4010 ms23964 KiB
#include "werewolf.h" #include <bits/stdc++.h> using namespace std; int ok[3][200555]; vector <int> v[200555]; int f(int s, int e, int l, int r){ queue <int> q; //printf("%d %d %d %d\n", s, e, l, r); memset(ok, 0, sizeof(ok)); if(l<=s){ ok[1][s]=1; q.push(1); q.push(s); } while(!q.empty()){ int type=q.front(); q.pop(); int x=q.front(); q.pop(); //printf("%d %d\n", type, x); if(l<=x&&x<=r&&!ok[!type][x]){ ok[!type][x]=1; q.push(!type); q.push(x); } for(int i=0;i<v[x].size();i++){ if(type==0){ if(v[x][i]<=r&&!ok[type][v[x][i]]){ 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]]){ ok[type][v[x][i]]=1; q.push(type); q.push(v[x][i]); } } } } return ok[0][e]; } 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(S[i], E[i], L[i], R[i]); } return A; }

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

werewolf.cpp: In function 'int f(int, int, int, int)':
werewolf.cpp:25: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:48: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...