TÓPICO
100% Wrong Answer!!
aamamun11 perguntou 6 years ago
Why this is getting 100% WA?? Passed all test cases given and I believe there is no problem with logic.
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main()
{
string tt;
getline(cin, tt);
int t = stoi(tt);
bool sp = false;
while(t!=0)
{
map<string, bool> bm, bp, bg, vm, vp, vg;
if(sp) cout<<"\n";
sp = true;
for(int i=0; i<t; i++)
{
string x;
string y;
getline(cin, x);
getline(cin, y);
if(y=="branco P")
bp[x] = true;
else if(y=="vermelho P")
vp[x] = true;
else if(y=="branco M")
bm[x] = true;
else if(y=="branco G")
bg[x] = true;
else if(y=="vermelho G")
vg[x] = true;
else if(y=="vermelho M")
vm[x] = true;
}
map<string, bool>::iterator it;
for(it=bp.begin(); it!=bp.end(); it++)
cout<<"branco P "<<it->first<<"\n";
for(it=bm.begin(); it!=bm.end(); it++)
cout<<"branco M "<<it->first<<"\n";
for(it=bg.begin(); it!=bg.end(); it++)
cout<<"branco G "<<it->first<<"\n";
for(it=vp.begin(); it!=vp.end(); it++)
cout<<"vermelho P "<<it->first<<"\n";
for(it=vm.begin(); it!=vm.end(); it++)
cout<<"vermelho M "<<it->first<<"\n";
for(it=vg.begin(); it!=vg.end(); it++)
cout<<"vermelho G "<<it->first<<"\n";
getline(cin, tt);
t = stoi(tt);
}
}