ACM

Problem:

HINT:

create two  array sizeof 30 (more than 26);

store the penalty time in one of them and other is used as a visited array

then for right verdict store the submission time & make it visited and if it is wrong add penalty time(20)

then last task to get total time and total solved problems by executing a for loop 0 to 25;

 

View Code

#include <bits/stdc++.h>
using namespace std;
int res[30];
bool rgt[30];
int main() {
int t;
memset(rgt,0,sizeof rgt);
while(1 )
{
cin>>t;
if(t==-1)
break;

char c;
cin>>c;
string s;
cin>>s;
if(s==”right”)
{
res[c-‘A’]+=t;
rgt[c-‘A’]=1;
}
else res[c-‘A’]+=20;

}
long long time=0,solved=0;
for(int i=0;i<26;i++)
if(rgt[i]) {time+=res[i];
solved++;
}
cout<<solved<<” “<<time<<endl;
return 0;
}

 

Advertisements

About waprogramming

I am in CSE,from CUET
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s