제출 #1066406

#제출 시각아이디문제언어결과실행 시간메모리
1066406boris_7Bosses (BOI16_bosses)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; vector<vector<ll>>gp; vector<ll>vis; vector<ll> d; ll ans = LLONG_MAX,cnt=0,comp=0; void dfs(ll u){ vis[u]=1; for(ll &i:gp[u]){ if(!vis[i]){ javascript:tab_clicked(1) d[i]+=d[u]+1; dfs(i); } } cnt+=d[u]; comp++; if(comp==gp.size()){ ans = min(ans,cnt); } } void solve(){ ll n; cin>>n; gp = vector<vector<ll>>(n); for(ll i =0;i<n;i++){ ll x; cin>>x; while(x--){ ll v; cin>>v; gp[--v].push_back(i); } } for(ll i = 0;i<n;i++){ vis = vector<ll>(n); d = vector<ll>(n); d[i]=1; cnt = 0,comp=0; dfs(i); } cout<<ans<<endl; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(nullptr); // ll t;cin>>t;while(t--) solve(); }

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

bosses.cpp: In function 'void dfs(ll)':
bosses.cpp:15:17: error: 'tab_clicked' was not declared in this scope
   15 |      javascript:tab_clicked(1)       d[i]+=d[u]+1;
      |                 ^~~~~~~~~~~
bosses.cpp:21:12: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     if(comp==gp.size()){
      |        ~~~~^~~~~~~~~~~
bosses.cpp:15:6: warning: label 'javascript' defined but not used [-Wunused-label]
   15 |      javascript:tab_clicked(1)       d[i]+=d[u]+1;
      |      ^~~~~~~~~~