제출 #584089

#제출 시각아이디문제언어결과실행 시간메모리
584089yanndev장난감 기차 (IOI17_train)C++17
5 / 100
7 ms1108 KiB
#include <bits/stdc++.h> using namespace std; const int MX = 5042; vector<int> graph[MX]; // 5 pts 2h37 vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { int n, m; n = (int)a.size(); //m = (int)u.size(); for (int i = 0; i < MX; i++) graph[i].clear(); vector<int> ans (n); bool isChain = true; for (int i = 0; i < (int)u.size(); i++) { graph[u[i]].push_back(v[i]); if (!(u[i] == v[i] || v[i] == u[i] + 1)) isChain = false; } if (isChain) { for (int i = n - 1; i >= 0; i--) { bool hasSelf = false; bool hasNext = false; for (auto& x: graph[i]) { if (x == i) { hasSelf = true; } else { hasNext = true; } } if (a[i] == 1) { if (hasSelf && r[i]) ans[i] = 1; else if (hasNext) ans[i] = ans[i + 1]; } else { if (hasSelf && !r[i]) ans[i] = 0; else if (hasNext) ans[i] = ans[i + 1]; else ans[i] = 1; } } return ans; } }

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

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:10:12: warning: unused variable 'm' [-Wunused-variable]
   10 |     int n, m;
      |            ^
train.cpp:56:1: warning: control reaches end of non-void function [-Wreturn-type]
   56 | }
      | ^
#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...