# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1110197 | 2024-11-09T01:39:01 Z | vjudge1 | Board Game (JOI24_boardgame) | C++17 | 21 ms | 6224 KB |
#include <bits/stdc++.h> using namespace std; #define ff(i, a, b) for(auto i=(a); i<=(b); ++i) #define ffr(i, b, a) for(auto i=(b); i>=(a); --i) #define nl "\n" #define ss " " #define pb push_back #define fi first #define se second #define sz(s) (int)s.size() #define ms(a,x) memset(a, x, sizeof (a)) #define re exit(0) #define cn continue typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<pii> vpii; typedef vector<pll> vpll; const int mod=1e9+7; //const int mod=998244353; const int maxn=1e5+105; const int maxm=4*maxn+5; const ll inf=1e18; mt19937 ran(time(0)); mt19937_64 ran64(time(0)); void rf(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen("o.inp","r")){ freopen("o.inp","r",stdin); freopen("o.out","w",stdout); } } void add(int &x, int y) { x+=y; if(x>=mod) x-=mod; if(x<0) x+=mod; } int n, m, k, x[maxn]; vi g[maxn]; int d[maxn]; string s; void bfs(int st) { ff(i, 1, n) d[i]=-1; d[st]=0; queue<int> q; q.push(st); while(!q.empty()) { int u=q.front(); q.pop(); for(auto v:g[u]) { if(d[v]+1) continue; d[v]=d[u]+1; q.push(v); } } ff(i, 1, n) cout<<d[i]<<nl; } signed main() { rf(); cin>>n>>m>>k; while(m--) { int u, v; cin>>u>>v; g[u].pb(v); g[v].pb(u); } cin>>s; ff(i, 1, n) cin>>x[i]; bfs(x[1]); re; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 3056 KB | Output is correct |
2 | Correct | 12 ms | 4944 KB | Output is correct |
3 | Correct | 21 ms | 6224 KB | Output is correct |
4 | Correct | 18 ms | 5800 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 3152 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 3152 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 3152 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 5712 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 5712 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 3152 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 3056 KB | Output is correct |
2 | Correct | 12 ms | 4944 KB | Output is correct |
3 | Correct | 21 ms | 6224 KB | Output is correct |
4 | Correct | 18 ms | 5800 KB | Output is correct |
5 | Incorrect | 4 ms | 3152 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |