제출 #889366

#제출 시각아이디문제언어결과실행 시간메모리
889366irmuun열쇠 (IOI21_keys)C++17
37 / 100
3062 ms27852 KiB
#include<bits/stdc++.h> #include "keys.h" using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() vector<int>find_reachable(vector<int>r,vector<int>u,vector<int>v,vector<int>c){ int n=r.size(); int mn=n; vector<int>p(n,0); vector<pair<int,int>>adj[n]; vector<int>now[n];//if found key_i for(int i=0;i<u.size();i++){ adj[u[i]].pb({v[i],c[i]}); adj[v[i]].pb({u[i],c[i]}); } vector<bool>used(n,0),found(n,0); for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ now[j].clear(); } fill(all(used),0); fill(all(found),0); queue<int>q;//nodes q.push(i); used[i]=true; while(!q.empty()){ int x=q.front(); q.pop(); if(!found[r[x]]){ found[r[x]]=true; for(auto y:now[r[x]]){ if(!used[y]){ used[y]=true; q.push(y); } } now[r[x]].clear(); } for(auto [y,k]:adj[x]){ if(found[k]==true){ if(!used[y]){ used[y]=true; q.push(y); } } else{ now[k].pb(y); } } } for(int j=0;j<n;j++){ if(used[j]){ p[i]++; } } mn=min(mn,p[i]); } for(int i=0;i<n;i++){ if(p[i]==mn){ p[i]=1; } else{ p[i]=0; } } return p; }

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

keys.cpp: In function 'std::vector<int> find_reachable(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
keys.cpp:19:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i=0;i<u.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...