제출 #243131

#제출 시각아이디문제언어결과실행 시간메모리
243131crossing0ver장난감 기차 (IOI17_train)C++17
5 / 100
12 ms1280 KiB
#include<bits/stdc++.h> #define vi vector<int> #define pb push_back #include "train.h" using namespace std; int n,m; vi X,Y,good,who,adj[5009]; vi CASE1() { vi ans(n); for (int i = n-1; i >= 0; i--) { bool flag = 0; for (int j : adj[i]) { if (j == i && who[i] == good[i]) { ans[i] = who[i]; flag = 1; break; } if (who[i] == ans[j] && j != i) { flag = 1; ans[i] = ans[j]; break; } } if (flag == 0) ans[i] = (!who[i]); } return ans; } vi who_wins(vi a1, vi r, vi st, vi en) { n = a1.size(), m = st.size(); X = st; Y = en; for (int i = 0; i < m; i++) adj[X[i]].pb(Y[i]); good = r; who = a1; bool case1 = 1; for (int i = 0; i < m; i++) { if (X[i] != Y[i] && X[i]+1 != Y[i]) case1 = 0; } if (case1) return CASE1(); // return res; } /* main() { cin >> n >> m; vi r(n),a1(n),st(m),en(m); for (int i = 0; i < n; i++) cin >> a1[i]; for (int i = 0; i < n ;i++) cin >> r[i]; for (int i = 0; i < m ;i++) { int x,y; cin >> st[i] >> en[i]; } vi ans = who_wins(a1,r,st,en); for (int i :ans) cout << i <<' '; }*/

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

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:43:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...