제출 #966271

#제출 시각아이디문제언어결과실행 시간메모리
966271AkibAzmain열쇠 (IOI21_keys)C++17
37 / 100
3028 ms21560 KiB
#include <vector> #include <bits/stdc++.h> using namespace std; using ll = long long; std::vector<int> find_reachable (std::vector<int> r, std::vector<int> u, std::vector<int> v, std::vector<int> c) { vector < vector < pair < int, int > > > adj (r.size ()); for (int i = 0; i < c.size (); ++i) adj[u[i]].push_back ({ v[i], c[i] }), adj[v[i]].push_back ({ u[i], c[i] }); map < int, vector < int > > a; for (int i = 0; i < r.size (); ++i) { set < int > kr; map < int, vector < int > > pd; vector < bool > vs (r.size ()); int cnt = 0; queue < int > q; q.push (i); while (!q.empty ()) { int x = q.front (); q.pop (); if (vs[x]) continue; vs[x] = true; ++cnt; kr.insert (r[x]); for (auto &x : pd[r[x]]) q.push (x); pd[r[x]].clear (); for (auto &c : adj[x]) if (kr.count (c.second)) q.push (c.first); else pd[c.second].push_back (c.first); } a[cnt].push_back (i); } vector < int > ans (r.size ()); for (auto &x : a.begin ()->second) ans[x] = 1; return ans; }

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

keys.cpp: In function 'std::vector<int> find_reachable(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
keys.cpp:10:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |   for (int i = 0; i < c.size (); ++i)
      |                   ~~^~~~~~~~~~~
keys.cpp:14:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |   for (int i = 0; i < r.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...