제출 #226634

#제출 시각아이디문제언어결과실행 시간메모리
226634AaronNaidu늑대인간 (IOI18_werewolf)C++14
15 / 100
333 ms32908 KiB
#include <bits/stdc++.h> using namespace std; vector<int> graph[100001]; vector<bool> worksFromStart, worksFromEnd; queue<int> q; vector<int> check_validity(int n, vector<int> x, vector<int> y, vector<int> s, vector<int> e, vector<int> l, vector<int> r) { vector<int> toRet; for (int i = 0; i < x.size(); i++) { graph[x[i]].push_back(y[i]); graph[y[i]].push_back(x[i]); } worksFromStart.resize(n); worksFromEnd.resize(n); //visited.resize(n); for (int i = 0; i < s.size(); i++) { for (int j = 0; j < n; j++) { worksFromStart[j] = false; worksFromEnd[j] = false; //visited[j] = false; } worksFromStart[s[i]] = true; q.push(s[i]); while (!q.empty()) { int x = q.front(); q.pop(); for (auto j : graph[x]) { if (!worksFromStart[j] and j >= l[i]) { worksFromStart[j] = true; q.push(j); } } } worksFromEnd[e[i]] = true; q.push(e[i]); while (!q.empty()) { int x = q.front(); q.pop(); for (auto j : graph[x]) { if (!worksFromEnd[j] and j <= r[i]) { worksFromEnd[j] = true; q.push(j); } } } bool works = false; for (int j = 0; j < n; j++) { if (worksFromStart[j] and worksFromEnd[j]) { //cout << "Change at " << j << "\n"; works = true; break; } } toRet.push_back(works); } return toRet; }

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

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:10:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < x.size(); i++)
                     ~~^~~~~~~~~~
werewolf.cpp:18:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     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...