제출 #341835

#제출 시각아이디문제언어결과실행 시간메모리
341835shrek12357늑대인간 (IOI18_werewolf)C++14
15 / 100
362 ms32620 KiB
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <set> #include <climits> #include <cmath> #include <fstream> #include <queue> #include <stack> #include <bitset> //#include "molecules.h" using namespace std; #define ll long long //cin.tie(0);ios_base::sync_with_stdio(0); const int MAXN = 1e5 + 5; int n; vector<int> adjList[MAXN]; bool ans1(int s, int e, int l, int r) { bool can[MAXN], can1[MAXN]; bool vis[MAXN], vis1[MAXN]; queue<int> q; q.push(s); for (int i = 0; i < n; i++) { vis[i] = false; vis1[i] = false; can[i] = false; can1[i] = false; } while (q.size() > 0) { int cur = q.front(); q.pop(); if (vis[cur]) { continue; } can[cur] = true; vis[cur] = true; for (auto i : adjList[cur]) { if(i >= l) q.push(i); } } q.push(e); while (q.size() > 0) { int cur = q.front(); q.pop(); if (vis1[cur]) { continue; } vis1[cur] = true; can1[cur] = true; for (auto i : adjList[cur]) { if (i <= r) { q.push(i); } } } for (int i = 0; i < n; i++) { if (can[i] == can1[i] && can[i]) { return true; } } return false; } vector<int> check_validity(int N, vector<int> x, vector<int> y, vector<int> s, vector<int> e, vector<int> l, vector<int> r) { n = N; for (int i = 0; i < x.size(); i++) { adjList[x[i]].push_back(y[i]); adjList[y[i]].push_back(x[i]); } vector<int> ans; for (int i = 0; i < s.size(); i++) { ans.push_back(ans1(s[i], e[i], l[i], r[i])); } return ans; }

컴파일 시 표준 에러 (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:73:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |  for (int i = 0; i < x.size(); i++) {
      |                  ~~^~~~~~~~~~
werewolf.cpp:78:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |  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...