제출 #261834

#제출 시각아이디문제언어결과실행 시간메모리
261834yabsed늑대인간 (IOI18_werewolf)C++17
0 / 100
4070 ms32376 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(s<=r){ ok[0][s]=1; q.push(0); q.push(s); } 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:29: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:52: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...