torest.'s blog

By torest., history, 10 months ago, In English

hallo codeforces

I have TLE in this problem C. Can I Square? in last round

with O($$$10^4\cdot\sqrt{2\cdot10^{10}}$$$)

My submission

but my friends dont got TLE with same time complexity

first submission

second submission

Can I get a re-judge for my submission ?

Or an explanation of the problem that occurred

MikeMirzayanov

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

»
10 months ago, # |
  Vote: I like it 0 Vote: I do not like it

because of skibidi

»
10 months ago, # |
  Vote: I like it +23 Vote: I do not like it

I bet it's because you use C-style IO (print, scanf) and C++-style (cin) at the same time. Never mix two styles and use

ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

as your friends did

And. does not worth pinging Mike)

  • »
    »
    10 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Regardless of his solution, the other solutions have a very high complexity

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

.

»
10 months ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

239292334 this will probably tle because it's clearly > 1e9 operations

»
10 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Find sum of array, check if sum is perfect square. I do not understand why you used the second loop :(

  • »
    »
    10 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    first submission & second submission for another user have same complexity but dont get TLE

»
10 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Bro you just had to find the sum of the array, and find a number x, such that x*x=sum

Some implementation:

long long int n , sum=0; cin >> n; int a[n]; for(int i = 0; i < n; i++) {cin >> a[i]; sum += a[i];} if (long long int(sqrt(sum)) == float(sqrt(sum))) cout << "YES\n"; else cout << "NO\n";