Saratov State University :: Online Contester


::Go
- home
- news
- register
- update personal info
- problemset archive
- submit
- status online
- standing
- contests
- virtual contests
- forum
- statistic
- FAQ
- links
- projects

::Poll
Are you registered on Codeforces?
Yes
No
What is it???

[results]

::webboard

Re: WA On test 4 , why?
Author: f.nasim
ID: 050447
Problem: 502
Contest: 0
Date: 2011-12-27 22:15:43

Fault is here:

....
int a=1;
for(int j=1;j<=i;j++)
a*=10;
....

'a' can be as large as 10^17 int data type gets overflow here. Just replace it with unsigned long long.

You are doing next_permutation() over the number of digits of n. But number of digits may be 18. Shouldn't (18!) get time limit exceeded?

But I got AC with your code! How is it possible in 0.5 seconds?

see sub-tree reply to that message


::Login
Forgot password?

::News
22.10.12 - The problems from the Southern Subregional Programming Contest 2012 added to the problemset archive (542 - 553).
22.10.12 - After the start of the contest the statements in PDF will be available by the link.
23.10.11 - The problems from the Southern Subregional Programming Contest 2011 added to the problemset archive (530 - 541).

::Counter

Server time: 2017-11-21 07:13:05Online Contester Team © 2002 - 2016. All rights reserved.