×

# QM6P5A editorial

Author: Chandan Boruah
Tester: Chandan Boruah
Editorialist: Chandan Boruah

EASY

# PREREQUISITES:

Simple Math, Brute Force.

# PROBLEM:

Given few valid sentences and few invalid, find the words that contribute to valid sentences. Valid sentences would have at least one word that is not there in invalid sentences.

# QUICK EXPLANATION:

Put all the valid words in a linked list. Enlist all invalid words in another linked list. Remove all invalid words from the valid words linked list. And print count of valid words.

# EXPLANATION:

Enlist all words in the valid words linked list. This would keep in the list all the words that can be valid. Now enlist all the words that are invalid. All words that are both in valid and invalid list would be invalid, according to problem description and examples. So print the count of words that are valid list but not in invalid list.

# AUTHOR'S SOLUTION IN C#:

using System;
using System.Collections.Generic;
class some
{
public static void Main()
{
for(int l=0;l<n;l++)
{
List<string>now=new List<string>();
List<string>no=new List<string>();
for(int i=0;i<tt;i++)
{
if(y=="yes")
{
foreach(string t in k)
{
if(!now.Contains(t))
{
}
}
}
else
{
foreach(string p in k)
{
if(!no.Contains(p))
{
}
}
}
}
int total=now.Count;
for(int i=0;i<no.Count;i++)
{
if(now.Contains(no[i]))
total--;
}
Console.WriteLine(total);
}
}
}


1339
accept rate: 0%

19.6k349497539

 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×15,125
×1,157
×168
×123