ICPC Dhaka Regional 2018 Problem E Helping the HR
Solution in C++:
///**********ALLAH IS ALMIGHTY************///
///AH Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
#include<bits/stdc++.h>
using namespace std;
char s[20];
int main()
{
int t,k,i,nc=17*1800,d=19*1800,e=25*1800,mis,cnt,di;
while((cin>>t)&&t!=0)
{
cnt=0;
for(k=0; k<t; k++)
{
int len,n=0,c=0,fs=0,ls=0,v=3600;
scanf("%s",s);
len=strlen(s);
for(i=2; i<len; i++)
{
if(s[i]!=':'&&i!=len-1)n=n*10+s[i]-'0';
else
{
if(i==len-1)n=n*10+s[i]-'0';
c++;
if(c<=3)
{
fs+=n*v;
if(c==3) v=3600;
else v/=60;
}
else ls+=n*v,v/=60;
n=0;
}
}
int mis=0;
di=ls-max(nc,fs);
if(s[0]=='D'&&fs>d)
{
mis=1;
}
if(s[0]=='E'&&fs>e)
{
mis=1;
}
if(s[0]=='D'&&di<8*3600)
{
mis=1;
}
if(s[0]=='E'&&di<9*3600)
{
mis=1;
}
cnt+=mis;
}
if(cnt==0)
cout<<"All OK"<<endl;
else if(cnt<4)
cout<<cnt<<" Point(s) Deducted"<<endl;
else
cout<<"Issue Show Cause Letter"<<endl;
}
}
No comments