You are not logged in. Please login at www.codechef.com to post your questions!

×

WA in TWTCLOSE

#include<iostream>
#include<cstring>

using namespace std;

int main()
{
    int n,k,count=0;
    string input;
    cin>>n>>k;
    cin.ignore();

    int tweet[1000];
    memset(tweet, -1, sizeof(tweet));
    for(int j=0;j<k;j++)
    {

        getline(cin,input);

        if(input=="CLOSEALL")
        {
            memset(tweet, -1, sizeof(tweet));
        }
        else
        {

            int index = input[6]-'0';
            tweet[index-1] *= -1;
        }
        for(int m=0;m<n;m++)
        {
            if(tweet[m]==1)
                count += 1;
        }
        cout<<count<<endl;
        count = 0;
    }
    return 0;
}

This returns WA for the question TWTCLOSE. Why?

asked 11 Dec '18, 23:48

wicardobeth's gravatar image

3★wicardobeth
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • 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:

×1,901
×1,056
×5

question asked: 11 Dec '18, 23:48

question was seen: 34 times

last updated: 11 Dec '18, 23:48