Usually i create a to_print() vector and iterate through it after running my main program for multiple test cases, but I think it increases my runtime and might be the cause for my TLE. But why i try cout for after each test case, i get wrong answer. Please help me solve this. Thanks
Just use this simple template, and then the problem wouldn’t happen if your code is correct. As is obvious, you need to input and solve each test case inside the while loop.
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin>>t;
while(t--){
int ans=0;
cout<<ans<<"\n";
}
}
1 Like