Submission #241911

#TimeUsernameProblemLanguageResultExecution timeMemory
241911marlicuSegway (COI19_segway)C++14
0 / 100
5 ms384 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; p++; akcelerator[p]++; } for (int i = 0; i < n; i++) { vrijeme[0].pb({0, i}); } /* cout << "0 : "; for (auto x : vrijeme[0]) { cout << x.X << "-" << x.Y; cout << "(" << akc[x.Y] << ") "; } cout << '\n'; */ int oznaka; for (int i = 1; i <= 300; i++) { vrijeme[i].resize(n); //cout << i << " : "; for (int x = 0; x < n; x++) { vrijeme[i][x] = vrijeme[i - 1][x]; oznaka = vrijeme[i][x].Y; if (akcelerator[i] && !akc[oznaka]) akc[oznaka] = 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); } 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 << konacno[i] << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...