/*
ID: noszaly1
TASK: {TASK}
LANG: C++11
*/
//Noszály Áron 11o Debreceni Fazekas Mihály Gimnázium
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair
#ifndef ONLINE_JUDGE
# define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
# define LOG(x) ((void)0)
#endif
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const double PI=acos(-1);
template<typename T> T getint() {
T val=0;
char c;
bool neg=false;
while((c=gc()) && !(c>='0' && c<='9')) {
neg|=c=='-';
}
do {
val=(val*10)+c-'0';
} while((c=gc()) && (c>='0' && c<='9'));
return val*(neg?-1:1);
}
struct ti {
ll mil;
ti() {
}
ti(ll h, ll m, ll s, ll mi) {
mil=1000*(s+60*(m+60*h))+mi;
}
string fmt() {
char buf[64];
ll d=mil;
ll h,m,s,mi;
mi=d%1000;d/=1000;
s=d%60;d/=60;
m=d%60;d/=60;
h=d%60;d/=60;
sprintf(&buf[0], "%02d:%02d:%02d,%03d", int(h),int(m),int(s),int(mi));
return string(buf);
}
};
struct st {
int ind;
ti bg,en;
vector<string> lines;
st() {
}
bool read() {
string s;
getline(cin, s);
stringstream ss;
ss<<s;
ss>>ind;
getline(cin, s);
s.push_back('-');
vector<int> nums;
bool num=false;
int curr=0;
for(auto i:s) {
if(num && isdigit(i)) {
curr=curr*10+i-'0';
}else if(num && !isdigit(i)) {
nums.push_back(curr);
curr=0;
num=false;
}else if(!num && isdigit(i)) {
num=true;
curr=i-'0';
}
}
bg=ti(nums[0], nums[1], nums[2], nums[3]);
en=ti(nums[4], nums[5], nums[6], nums[7]);
bool cont=true;
do {
getline(cin, s);
if(s=="#") {
cont=false;
break ;
}else if(s=="") {
break ;
}
lines.push_back(s);
}while(1);
if(cont) return true;
return false;
}
};
int main() {
IO;
vector<st> s;
do {
s.push_back(st());
if(!s.back().read()) break ;
}while(1);
int x;
cin>>x;
for(auto& i:s) {
i.bg.mil+=x;
i.en.mil+=x;
}
bool first=true;
for(auto i:s) {
if(first) {
first=false;
} else cout<<"\n";
cout<<i.ind<<"\n";
cout<<i.bg.fmt()<<" --> "<<i.en.fmt()<<"\n";
for(auto j:i.lines) {
cout<<j<<"\n";
}
}
cout<<"#\n";
return 0;
}
Compilation message
titlovi.cpp: In function 'int main()':
titlovi.cpp:87:8: warning: '<anonymous>.st::ind' may be used uninitialized in this function [-Wmaybe-uninitialized]
struct st {
^~
titlovi.cpp:87:8: warning: '<anonymous>.st::bg' may be used uninitialized in this function [-Wmaybe-uninitialized]
titlovi.cpp:87:8: warning: '<anonymous>.st::en' may be used uninitialized in this function [-Wmaybe-uninitialized]
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
252 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |