Submission #241920

#TimeUsernameProblemLanguageResultExecution timeMemory
241920marlicuSegway (COI19_segway)C++14
100 / 100
668 ms1396 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define X first #define Y second typedef pair <int, int> pii; const int MAXN = 2e4 + 5; int n, m; int brzina[MAXN][3]; int akcelerator[305]; int akc[MAXN]; vector <pii> vrijeme; int konacno[MAXN]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for (int i = 0; i < n; i++) { cin >> brzina[i][0]; cin >> brzina[i][1]; cin >> brzina[i][2]; } cin >> m; for (int i = 0; i < m; i++) { int p; cin >> p; akcelerator[p]++; } for (int i = 0; i < n; i++) vrijeme.pb({0, i}); for (int i = 0; i < 300; i++) { int ispred = 0; //cout << i << " : "; for (int x = 0; x < n; x++) { int oznaka = vrijeme[x].Y; if (x && vrijeme[x].X != vrijeme[x - 1].X) ispred = x; if (akcelerator[i] && !akc[oznaka]) akc[oznaka] = ispred % 20; if (akc[oznaka]) { konacno[oznaka]++; akc[oznaka]--; } else { if (i < 100) konacno[oznaka] += brzina[oznaka][0]; else if (i < 200) konacno[oznaka] += brzina[oznaka][1]; else konacno[oznaka] += brzina[oznaka][2]; } //cout << vrijeme[i][x].X << "-" << vrijeme[i][x].Y; //cout << "(" << akc[oznaka] << ") "; } vrijeme.clear(); for (int x = 0; x < n; x++) vrijeme.pb({konacno[x], x}); sort(vrijeme.begin(), vrijeme.end()); //cout << '\n'; } for (int i = 0; i < n; i++) cout << konacno[i] << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...