답안 #241911

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