Блог пользователя adityav664

Автор adityav664, 4 года назад, По-английски

I'm getting runtime error again and again and i can't seem to find any issue with my code as codeforces custom test compiler is also printing output just fine but when i submit code i get runtime error plz help, these 1 are questions that i'm getting issue with. 1. 120B - Quiz League 178911312

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
4 года назад, скрыть # |
 
Проголосовать: нравится -9 Проголосовать: не нравится

I suggest that you learn about Undefied Behaviour. On C++ there are some (actually many) operations for which there is not a guaranteed behaviour for all environments. As the C++ committee is not the ones who make compilers, nor ones who make computer architectures, they can't enforce it for every existing compiler or architecture, otherwise it would be a real pain deciding what behaviour is effective for every environment. Thus, they put it as an undefined behaviour, so you cannot ensure them to work the way you expected on every environment.

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

i am not a pro but i think this question wants input and output from a file. so write this after main function is declared :

#ifndef ONLINE_JUDGE
 
    // For getting input from input.txt file
    freopen("input.txt", "r", stdin);
 
    // Printing the Output to output.txt file
    freopen("output.txt", "w", stdout);
 
#endif

and then when you submit your code, it will throw a time limit exceeded error, which i think you can solve on your own by changing your program.