제출 #819904

#제출 시각아이디문제언어결과실행 시간메모리
819904Marco_EscandonKeys (IOI21_keys)C++17
9 / 100
3063 ms41888 KiB
#include "keys.h"
#include <cassert>
#include <cstdio>


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<vector<pair<ll,ll>>> cad;
vector<vector<ll>> ca;
std::vector<int> find_reachable(std::vector<int> r, std::vector<int> u, std::vector<int> v, std::vector<int> c)
{
    ll n=r.size();
    ll m=u.size();
    ca.resize(n*2+1);cad.resize(n*2+1);
    for(int i=0; i<m; i++){
        cad[u[i]].push_back({v[i],c[i]});
        cad[v[i]].push_back({u[i],c[i]});
        ca[c[i]].push_back(u[i]);
        ca[c[i]].push_back(v[i]);
    }
    ll bs=n+3;
    vector<int> sol(n,0);
    for(int i=0; i<n; i++)
    {
        vector<ll> v(n*2,0),lla(n*2,0);
        queue<ll> q;
        v[i]=2;
        q.push(i);
        while(!q.empty())
        {
            ll a=q.front();q.pop();


         if(lla[r[a]]==0)
            for(auto j:ca[r[a]])
            {
                if(v[j]==1)
                {
                    v[j]=2;
                    q.push(j);
                }
            }
            lla[r[a]]=1;
            for(auto j:cad[a])
            {
                if(v[j.first]==0||v[j.first]==1)
                {
                    v[j.first]=1;
                    if(lla[j.second]==1)
                    {
                        v[j.first]=2;
                        q.push(j.first);
                    }
                }
            }
        }
        ll cont=0;
        for(auto j:v)
            if(j==2)
                cont++;
        sol[i]=cont;
        bs=min(bs,cont);
    }
    for(int i=0; i<n; i++)
        if(sol[i]==bs)
            sol[i]=1;
        else sol[i]=0;
    return sol;
}

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

keys.cpp: In function 'std::vector<int> find_reachable(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
keys.cpp:35:10: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   35 |          if(lla[r[a]]==0)
      |          ^~
keys.cpp:44:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   44 |             lla[r[a]]=1;
      |             ^~~
#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...