Submission #232461

# Submission time Handle Problem Language Result Execution time Memory
232461 2020-05-17T06:46:03 Z VEGAnn Titlovi (COCI19_titlovi) C++14
30 / 50
6 ms 3456 KB
#include <bits/stdc++.h>
#define ft first
#define sd second
#define sz(x) ((int)x.size())
using namespace std;
const int N = 100100;
string s[N], cur;
int n = 0, T;

int i(char c){
    return (c - '0');
}

void OUT(int x, int len){
    cur = to_string(x);
    while (sz(cur) < len)
        cur = "0" + cur;
    cout << cur;
}

void out(int h, int m, int s, int t){
    t += T;
    s += t / 1000;
    t %= 1000;
    t = (t + 1000) % 1000;

    m += s / 60;
    s %= 60;
    s = (s + 60) % 60;

    h += m / 60;
    m %= 60;
    m = (m + 60) % 60;

    OUT(h, 2);
    cout << ":";
    OUT(m, 2);
    cout << ":";
    OUT(s, 2);
    cout << ",";
    OUT(t, 3);
}

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

    while (1){
        getline(cin, s[n++]);
        if (s[n - 1][0] == '#')
            break;
    }

    cin >> T;

    for (int I = 0; I < n; I++)
        if (s[I].find("-->") == std::string::npos)
            cout << s[I] << '\n';
        else {
            int h1 = i(s[I][0]) * 10 + i(s[I][1]);
            int m1 = i(s[I][3]) * 10 + i(s[I][4]);
            int s1 = i(s[I][6]) * 10 + i(s[I][7]);
            int t1 = i(s[I][9]) * 100 + i(s[I][10]) * 10 + i(s[I][11]);

            int h2 = i(s[I][17]) * 10 + i(s[I][18]);
            int m2 = i(s[I][20]) * 10 + i(s[I][21]);
            int s2 = i(s[I][23]) * 10 + i(s[I][24]);
            int t2 = i(s[I][26]) * 100 + i(s[I][27]) * 10 + i(s[I][28]);

            out(h1, m1, s1, t1);
            cout << " --> ";
            out(h2, m2, s2, t2);
            cout << '\n';
        }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 3456 KB Output isn't correct
2 Correct 6 ms 3456 KB Output is correct
3 Correct 6 ms 3456 KB Output is correct
4 Correct 6 ms 3456 KB Output is correct
5 Incorrect 6 ms 3456 KB Output isn't correct