Submission #628945

#TimeUsernameProblemLanguageResultExecution timeMemory
628945hy_1Keys (IOI21_keys)C++17
0 / 100
1 ms228 KiB
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <cmath> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #include <unordered_map> using namespace std; int dfs(int source , vector<int> &c , int vv , vector<vector<pair<int , int > > > &adj){ int cnt = 0; stack<int> st; st.push(source); set<int> stock; stock.insert(c[source]); vector<int> visited(vv , false); // int cnt = 0; while(!st.empty()){ int cur = st.top(); st.pop(); visited[cur] = true; for(pair<int , int > i : adj[cur]){ if(visited[i.first] == false && (count(stock.begin() , stock.end() , i.second)) != 0){ st.push(i.first); visited[i.first] = true; cnt++; } } } return cnt; } vector<int> find_reachable(vector<int> r, vector<int> u, vector<int> v, vector<int> c) { // vector<vector< pair<int, int > > > adj(r.size()); vector<int> ans(r.size() , 1); for(int i=0; i<u.size(); i++){ if(r[u[i]] == 0 && v[i] != u[i]){ ans[i] = 0; } } for(int i=0; i<v.size(); i++){ if(r[v[i]] == 0 && u[i] != v[i]){ ans[i] = 0; } } return ans; }

Compilation message (stderr)

keys.cpp: In function 'std::vector<int> find_reachable(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
keys.cpp:66:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |  for(int i=0; i<u.size(); i++){
      |               ~^~~~~~~~~
keys.cpp:71:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |  for(int i=0; i<v.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...
#Verdict Execution timeMemoryGrader output
Fetching results...