답안 #1041450

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041450 2024-08-02T04:05:34 Z vjudge1 Segway (COI19_segway) C++17
100 / 100
58 ms 1052 KB
#include <bits/stdc++.h>
using namespace std;

#define time first
#define dist second

const int N = 2e4 + 10, M = 325, A = 1.5e4 + 100;
int n, m, speed[N][3], a[M], nitro[N], pos[A];
pair<int, int> stat[N];

void reach(int i, int x){
    if (stat[i].dist >= x)
        return;

    int use = min(nitro[i], x - stat[i].dist);
    nitro[i] -= use;
    stat[i].time += use;
    stat[i].dist += use; 

    if (stat[i].dist < 100 and 100 <= x){
        stat[i].time += speed[i][stat[i].dist / 100] * (100 - stat[i].dist);
        stat[i].dist = 100;
    }
    if (stat[i].dist < 200 and 200 <= x){
        stat[i].time += speed[i][stat[i].dist / 100] * (200 - stat[i].dist);
        stat[i].dist = 200;
    }
    if (stat[i].dist < 300 and 300 <= x){
        stat[i].time += speed[i][stat[i].dist / 100] * (300 - stat[i].dist);
        stat[i].dist = 300;
    }

    stat[i].time += speed[i][stat[i].dist / 100] * (x - stat[i].dist);
    stat[i].dist = x;
}

int main(){
    cin >> n;
    for (int i = 1; i <= n; i ++){
        for (int j = 0; j < 3; j ++)
            cin >> speed[i][j];
        stat[i] = {0, 0};
    }
    cin >> m;
    for (int i = 0; i < m; i ++)
        cin >> a[i];
    a[m] = 300;

    for (int acc = 0; acc <= m; acc ++){
        memset(pos, 0, sizeof pos);
        for (int p = 1; p <= n; p ++)
            reach(p, a[acc]), pos[stat[p].time]++;

        for (int i = 1; i < A; i ++)
            pos[i] += pos[i - 1];

        for (int i = 1; i <= n; i ++){
            if (nitro[i]) continue;
            nitro[i] = pos[stat[i].time - 1] % 20;
        }
    }

    for (int i = 1; i <= n; i ++)
        cout << stat[i].first << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 4 ms 604 KB Output is correct
5 Correct 22 ms 1052 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 4 ms 604 KB Output is correct
5 Correct 22 ms 1052 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 3 ms 344 KB Output is correct
17 Correct 2 ms 348 KB Output is correct
18 Correct 8 ms 564 KB Output is correct
19 Correct 16 ms 604 KB Output is correct
20 Correct 13 ms 604 KB Output is correct
21 Correct 27 ms 912 KB Output is correct
22 Correct 45 ms 856 KB Output is correct
23 Correct 58 ms 956 KB Output is correct