Submission #241918

#TimeUsernameProblemLanguageResultExecution timeMemory
241918marlicuSegway (COI19_segway)C++14
0 / 100
14 ms2260 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[305]; 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] >> brzina[i][1] >> brzina[i][2]; } cin >> m; int p; for (int i = 0; i < m; i++) { cin >> p; akcelerator[p]++; } for (int i = 0; i < n; i++) { vrijeme[0].pb({0, i}); } int oznaka, vp, bp; for (int i = 1; i <= 300; i++) { vrijeme[i].resize(n); vp = -1, bp = 0; //cout << i << " : "; for (int x = 0; x < n; x++) { vrijeme[i][x] = vrijeme[i - 1][x]; oznaka = vrijeme[i][x].Y; if (vrijeme[i][x].X > vp) { vp = vrijeme[i][x].X; bp = x; } if (akc[oznaka] > 0) vrijeme[i][x].X++; else { if (i <= 100) vrijeme[i][x].X += brzina[oznaka][0]; else if (i <= 200) vrijeme[i][x].X += brzina[oznaka][1]; else vrijeme[i][x].X += brzina[oznaka][2]; } //cout << vrijeme[i][x].X << "-" << vrijeme[i][x].Y; //cout << "(" << akc[oznaka] << ") "; akc[oznaka] = max(0, akc[oznaka] - 1); if (akcelerator[i] && !akc[oznaka]) akc[oznaka] = bp % 20; } sort(vrijeme[i].begin(), vrijeme[i].end()); //cout << '\n'; } for (int i = 0; i < n; i++) { konacno[vrijeme[300][i].Y] = vrijeme[300][i].X; } for (int i = 0; i < n; i++) { //cout << "(" << akc[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...