제출 #605411

#제출 시각아이디문제언어결과실행 시간메모리
605411MohamedAliSaidane기지국 (IOI20_stations)C++14
10 / 100
887 ms508 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pii> vpi; typedef vector<pll> vpl; #define pb push_back #define popb pop_back #define all(x) (x).begin(),(x).end() #define ff first #define ss second vi label(int n, int k, vi u, vi v) { vi rep(n, -1); rep[0] = 0; vi adj[n]; for(int i= 0 ; i <n - 1; i ++) { adj[u[i]].pb(v[i]); adj[v[i]].pb(u[i]); } queue<pii> q; q.push({0,0}); while(!q.empty()) { int node = q.front().ff; int val = q.front().ss; q.pop(); val = (val << 3) + node; rep[node] = val; for(auto e: adj[node]) { if(rep[e] == -1) { q.push({e, val}); } } } return rep; } int find_next_station(int s, int t, vi c) { set<int> part; int cur = t; int u = (s & 1) + (s & 2) + (s & 4); int ot = s; ot = ot >> 3; int par = (ot & 1) + (ot & 2) + (ot & 4); for(int i= 0; i < 8; i ++) { int v = (cur & 1) + (cur & 2) + (cur & 4); part.insert(v); cur = (cur >> 3); } if(part.count(u) != 0) { for(auto e: c) { int v = (e & 1) + (e & 2) + (e & 4); if(part.count(v) != 0 && v != par) return e; } } else { for(auto e: c) { int v = (e & 1) + (e & 2) + (e & 4); if(v == par) return e; } } }

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

stations.cpp: In function 'int find_next_station(int, int, vi)':
stations.cpp:51:18: warning: control reaches end of non-void function [-Wreturn-type]
   51 |         set<int> part;
      |                  ^~~~
#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...