1 / 2
Oct 2017

I solved the question AMR12D. when i submitted the solution
#include <bits/stdc++.h>
using namespace std;

#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()

int main()
{
** ios_base::sync_with_stdio(false);**
** cin.tie(NULL);**

** int t;**
** cin>>t;**
** while(t–)**
** {**
** string orig;**
** cin>>orig;**
** string rev = orig;**
** reverse(rev.begin(),rev.end());**
** if(orig == rev)**
** cout<<“YES”<<endl;**
** else**
** cout<<“NO”<<endl;**
** }**
** return 0;**
}
which was really suprising to me because the logic of the question is pretty simple
now for the same code i commented out
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
it resulted in ac,
could anyone explain whats going here

  • created

    Oct '17
  • last reply

    Oct '17
  • 1

    reply

  • 1.2k

    views

  • 2

    users

  • 1

    link

You must test two more options:

  1. //ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  2. ios_base::sync_with_stdio(false);
    //cin.tie(NULL);

from all 4 combinations.

After that, you can repeat your queston but that time more correctly. :wink:

PS

#include <iostream>

using namespace std;

int main(){
    for (int i = 0; i < 100; ++i) 
           cout << i +1 << "  @zaidjan!\n  You paste your code very bad! \n";.
}

Suggested Topics

Topic Category Replies Views Activity
Off-topic 1 81 Apr 9

Want to read more? Browse other topics in Off-topic or view latest topics.