Submission #232464

#TimeUsernameProblemLanguageResultExecution timeMemory
232464VEGAnnTitlovi (COCI19_titlovi)C++14
50 / 50
7 ms3456 KiB
#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 - bool(t < 0); t %= 1000; t = (t + 1000) % 1000; m += s / 60 - bool(s < 0); s %= 60; s = (s + 60) % 60; h += m / 60 - bool(m < 0); 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 timeMemoryGrader output
Fetching results...