답안 #232455

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
232455 2020-05-17T06:39:50 Z NONAME Titlovi (COCI19_titlovi) C++17
50 / 50
4 ms 384 KB
#include <bits/stdc++.h>
#define sz(x) int(x.size())
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define N 100500
#define oo ll(1e16)
#define ft first
#define sd second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define el '\n'
#define elf endl
#define base ll(1e9 + 7)
using namespace std;
typedef long long ll;
typedef long double ld;

vector <pair <ll, ll> > v;
vector <string> k;
vector <pair <int, string> > text;

void print(ll tim) {
    ll h = ((tim / 1000) / 60) / 60;
    ll m = ((tim / 1000) / 60) % 60;
    ll s = (tim / 1000) % 60;
    ll t = tim % 1000;

    if (h < 10) cout << 0;
    cout << h << ":";
    if (m < 10) cout << 0;
    cout << m << ":";
    if (s < 10) cout << 0;
    cout << s << ",";
    if (t < 10) cout << "00";
        else if (t < 100) cout << "0";
    cout << t;
}

ll to_int(string t) {
    ll rs = 0;

    for (int i = 0; i < sz(t); i++)
        (rs *= 10) += (t[i] - '0');

    return rs;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//    in("input.txt");

    string s = "";

    while (1) {
        if (s == "")
            cin >> s;

        if (s == "#")
            break;

        k.pb(s);

        ll hh1, hh2, mm1, mm2, ss1, ss2, tt1, tt2;
        string s1, s2;

        cin >> s1;
        cin >> s2;
        cin >> s2;

        hh1 = to_int(s1.substr(0, 2));
        mm1 = to_int(s1.substr(3, 2));
        ss1 = to_int(s1.substr(6, 2));
        tt1 = to_int(s1.substr(9, 3));

        hh2 = to_int(s2.substr(0, 2));
        mm2 = to_int(s2.substr(3, 2));
        ss2 = to_int(s2.substr(6, 2));
        tt2 = to_int(s2.substr(9, 3));

        ll tim1 = tt1 + (ss1 * 1000) + (mm1 * 60000) + (hh1 * 60 * 60000);
        ll tim2 = tt2 + (ss2 * 1000) + (mm2 * 60000) + (hh2 * 60 * 60000);

        v.pb(mp(tim1, tim2));

        while (1) {
            getline(cin, s);
            if (s == "")
                continue;

            if (s == "#" || (s[0] >= '0' && s[0] <= '9'))
                break;

            text.pb(mp(sz(k) - 1, s));
        }

        if (s == "#")
            break;
    }

    ll change;
    cin >> change;
    int p = 0;

    for (int i = 0; i < sz(k); i++) {
        cout << k[i] << el;
        ll tim1 = v[i].ft;
        ll tim2 = v[i].sd;

        print(tim1 + change);
        cout << " --> ";
        print(tim2 + change);
        cout << el;

        while (text[p].ft == i) {
            cout << text[p].sd << el;
            p++;
        }

        if (i != sz(k) - 1)
            cout << el;
    }
    cout << "#";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct