Submission #144119

#TimeUsernameProblemLanguageResultExecution timeMemory
144119emilemSegway (COI19_segway)C++14
0 / 100
3 ms504 KiB
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> speed(n), speed2(n), speed3(n); for (int i = 0; i < n; ++i) cin >> speed[i] >> speed2[i] >> speed3[i]; int m; cin >> m; vector<bool> isPoint(300, false); vector<int> passed(300, 0); while (m--) { int i; cin >> i; isPoint[i] = true; } vector<int> ans(n, -1); vector<int> pos(n); vector<int> secInMove(n); vector<bool> boosted(n); vector<int> secInBoost(n); vector<int> maxSecInBoost(n); for (int sec = 1; ; ++sec) { int hasAnswered = 0; vector<int> addPassed; for (int rider = 0; rider < n; ++rider) { if (ans[rider] != -1) continue; ++hasAnswered; ++secInMove[rider]; if (secInMove[rider] == (boosted[rider] ? 1 : speed[rider])) { if (boosted[rider] && secInBoost[rider] + 1 == maxSecInBoost[rider]) boosted[rider] = false; else ++secInBoost[rider]; secInMove[rider] = 0; ++pos[rider]; if (pos[rider] == 100) speed[rider] = speed2[rider]; else if (pos[rider] == 200) speed[rider] = speed3[rider]; else if (pos[rider] == 300) { ans[rider] = sec; continue; } if (isPoint[pos[rider]]) { boosted[rider] = true; secInBoost[rider] = 0; maxSecInBoost[rider] = passed[pos[rider]] % 20; addPassed.push_back(pos[rider]); } } } if (!hasAnswered) break; for (int i = 0; i < addPassed.size(); ++i) ++passed[addPassed[i]]; } for (int rider = 0; rider < n; ++rider) cout << ans[rider] << ' '; cout << endl; char I; cin >> I; }

Compilation message (stderr)

segway.cpp: In function 'int main()':
segway.cpp:66:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < addPassed.size(); ++i)
                   ~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...