IamDeep_9571's blog

By IamDeep_9571, history, 5 weeks ago, In English

my code for that problem is working on custom test of cf and even in my system compiler.. and i'm getting required answer to all test cases but on submission at cf I got strange massage saying wrong answer... And that comment is

Can't find file K:\ramdisk\codeforces61\9c5383c0192771e8d22775984f40362f\check-e068a9b89c80e5d690845be2e470a589\run\output.txt invokerId=ef4de2e8346ee1a664bb563100318fea, location=203279215

plz help me to get rid of this..

 
 
 
 
  • Vote: I like it
  • -9
  • Vote: I do not like it

»
5 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

The problem probably requires reading/writing from a specified file. Can you link the problem and your submission?

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it +3 Vote: I do not like it
      Spoiler

      You can replace these lines in int main()

          #ifndef ONLINE_JUDGE
          freopen("in.txt", "r", stdin);
          freopen("output.txt", "w", stdout);
          #endif
      

      with,

          freopen("input.txt", "r", stdin);
          freopen("output.txt", "w", stdout);
      
      • »
        »
        »
        »
        5 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        thanks a lot bhaiya.. it solved my issue.. but i wanted to know the difference plz provide me some useful links to get deeper if possible..

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    In addition to this, make sure you know what the macros you're using actually do. Then reread the problem statement. Mainly the top part, which is conveniently bolded so that you'll look at it.

    Once you've figured that out, look at the diagnostics that CF is giving you. You're basically getting free debugging help from the system. Given these resources you should be able to figure this out on your own.

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

You can use this piece of code for accessing input and output files.

ifstream in;
ofstream out;
in.open("input.txt");
out.open("output.txt");

Because, as far as I think, #ifndef ONLINE_JUDGE is ignored by codeforces compiler. Even if we write this in codes with input and output from stdin and stdout, it works (ignoring the command to accept input from files).

And also, your submission diagnostics say that, code is executed with error 'out of bounds'. So you must also check that issue.

Hope this helps.

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Its giving you error because on your System Compiler and Custom test, your INPUT/OUTPUT is from STANDARD INPUT/OUTPUT STREAM.

In the question you are required to read/write on files. Just keep these two lines of code in your int main() function...

freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);

Just comment it out when you don't need it.

»
5 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

As described in the question you need to input/output from files not a standard input/output. Something is wrong with your files , use freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

If this doesn't work , check if the described file in your code is present at that position, if present check if it is having the same name as described in your code .