답안 #241918

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
241918 2020-06-26T10:04:31 Z marlicu Segway (COI19_segway) C++14
0 / 100
14 ms 2260 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 6 ms 768 KB Output is correct
3 Incorrect 14 ms 2260 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 6 ms 768 KB Output is correct
3 Incorrect 14 ms 2260 KB Output isn't correct
4 Halted 0 ms 0 KB -