답안 #706799

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
706799 2023-03-07T18:37:41 Z Nursik Segway (COI19_segway) C++17
100 / 100
43 ms 1396 KB
#include <iostream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <functional>
#include <complex>
#include <random>

using namespace std;
 
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ld long double
 
const ll maxn = 1e5 + 1, maxm = 1e3 + 1;
const ll mod = 1e9 + 7, cmod = 998244353, inf = 1e9, blcok = 400, p2 = 31;
const ld eps = 1e-9;

int n, m;
int is[maxm], sped[maxn], pref[maxn], pos[maxn];
ll ans[maxn], a[3][maxn];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; ++i){
        for (int j = 0; j < 3; ++j){
            cin >> a[j][i];
        }
        pos[i] = 0;
    }
    cin >> m;
    for (int x, i = 1; i <= m; ++i){
        cin >> x;
        is[x] = 1;
    }
    for (int i = 0; i < 300; ++i){
        for (int j = 0; j <= 15000; ++j){
            pref[j] = 0;
        }
        ll mx = 0;
        for (int j = 1; j <= n; ++j){
            pref[ans[j]] += 1;
            mx = max(mx, ans[j]);
        }
        for (int j = 1; j <= mx; ++j){
            pref[j] += pref[j - 1];
        }
       /* if (i == 189){
          //  cout <<
            for (int j = 1; j <= n; ++j){
                cout << ans[j] << " " << pref[ans[j] - 1] << '\n';
            }
            exit(0);
        }
        */
        int type = 0;
        if (i >= 100 && i < 200){
            type = 1;
        }
        else if (i >= 200){
            type = 2;
        }
        for (int j = 1; j <= n; ++j){
            if (sped[j] && pos[j] < 300){
                pos[j] += 1;
                ans[j] += 1;
                sped[j] -= 1;
            }
            else if (pos[j] < 300){
                int val = (ans[j] - 1 >= 0 ? pref[ans[j] - 1] : 0);
                val %= 20;
                if (is[i] > 0){
                    sped[j] = val;
                }
                if (sped[j] > 0){
                   // cout << "ok\n";
                    sped[j] -= 1;
                    pos[j] += 1;
                    ans[j] += 1;
                }
                else{
                    ans[j] += a[type][j];
                }
            }
        }
        /*if (i == 100){
            cout << ans[1];
            cout << a[type][1] << '\n';
            exit(0);
        }*/
    }
    for (int i = 1; i <= n; ++i){
        cout << ans[i] << '\n';
    }
}
/*
*/


# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 328 KB Output is correct
2 Correct 4 ms 340 KB Output is correct
3 Correct 6 ms 340 KB Output is correct
4 Correct 9 ms 580 KB Output is correct
5 Correct 37 ms 1396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 4 ms 332 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 328 KB Output is correct
2 Correct 4 ms 340 KB Output is correct
3 Correct 6 ms 340 KB Output is correct
4 Correct 9 ms 580 KB Output is correct
5 Correct 37 ms 1396 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 3 ms 340 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 4 ms 332 KB Output is correct
13 Correct 3 ms 340 KB Output is correct
14 Correct 3 ms 340 KB Output is correct
15 Correct 4 ms 340 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 5 ms 468 KB Output is correct
18 Correct 5 ms 468 KB Output is correct
19 Correct 22 ms 820 KB Output is correct
20 Correct 27 ms 968 KB Output is correct
21 Correct 34 ms 1128 KB Output is correct
22 Correct 43 ms 1364 KB Output is correct
23 Correct 39 ms 1344 KB Output is correct