why do people insist on untie'ng cin and cout?  if one does that, output
might not go out prior to blocking on input.

You are also flushing stdout, not cout.  You unsync'd them.  use 'cout <<
endl;' to flush cout instead of just '\n'.

Pretty much don't ever use the first commented out statement at the start
of main.  If you really wanted to do optimal i/o, switch to pure printf and
scanf and avoid using std streams.

Edwin

On Thu, Apr 18, 2019 at 9:47 AM Shubham Nagaria <[email protected]>
wrote:

> Yes I have used only cin/cout everywhere.
>
> After every cout I am flushing the output, so in my opinion it should not
> matter if the output is flushed automatically, since i am always flushing
> it.
>
> Below is the code which passed :
>
> #include<bits/stdc++.h>
> using namespace std;
> #define ll long long
> #define ld long double
> #define MAX 200005
> #define MOD 998244353
> #define pb push_back
> #define mp make_pair
> #define f first
> #define s second
>
> ll n, m, i, j, k, t, l, r,tmp, ans, cnt,curr, flag, sum, mn, mx,
> mxi,x,pre,strt,en;
> string s, a, b;
> vector<pair<ll,ll> > v;
> int main()
> {
>     //ios_base::sync_with_stdio(false);cin.tie(NULL);
>     // #ifndef ONLINE_JUDGE
>     //     freopen("in.txt", "r", stdin);
>     // #endif
>         cin>>t>>n>>m;
>         while(t--){
>             n=365;
>             mx = 0;
>             while(n--){
>                 curr=0;
>                 for(i=0;i<18;i++)cout<<18<<" ";cout<<"\n";
>                 fflush(stdout);
>                 for(i=0;i<18;i++){cin>>l;curr+=l;}
>                 mx = max(mx, curr);
>
>             }
>             cout<<mx<<"\n";
>             fflush(stdout);
>             cin>>i;
>             if(i==-1)return 0;
>
>         }
>
>
>
>     return 0;
> }
>
> If I uncomment the fastio statement, it gives TLE.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/acd91df7-566a-47e1-a3ad-11523d51afd6%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAE%3D7p0Q5DzXtUwNk3XpReBfYGnfs-hQLW8HO8xqGsPrq%2B3uj_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to