imtheonly1's blog

By imtheonly1, history, 5 months ago, In English

No one should share his/her Accepted solution during a live contest.

However, suppose someone shares an accepted solution during the live contest to his friends or public telegram channels. In that case, good people should feed the code to a plagiarism checker[currently we don't have such functionality on codeforces MikeMirzayanov ].

The plagiarism checker will easily find the original author and others who copied the code. It is similar to hacking post-contest, but we submit plags during a live contest here. There should be a reward for the first plag finder.

This will surely discourage solution-sharing during live contests.

Full text and comments »

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

By imtheonly1, history, 5 months ago, In English

What mistake I'm Doing?

The python code is working fine but C++ doesn't.

PYTHON

N = 1000000000000000000
i = 2
c = 0
while 1 + i + i * i + i * i * i <= N:
    temp = 1 + i + i * i + i * i * i
    x = i * i * i
    while temp <= N:
        c += 1
        x = x * i
        temp = temp + x
    i += 1
print(c)
# OUPTUT
# 1037545

# =====
# Used: 936 ms, 0 KB

CPP

// author: imtheonly1
// time: 2024-07-28 19:33:55
//
// Problem: E2. Rudolf and Snowflakes (hard version)
// URL: https://mirror.codeforces.com/contest/1846/problem/E2
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)

#include <iostream>
#include <cmath>

int main() {
    long long N = 1000000000000000000LL; // 1e18
    long long i = 2;
    long long c = 0;
    
    while (1 + i + i * i + i * i * i <= N) {
        long long temp = 1 + i + i * i + i * i * i;
        long long x = i * i * i;
        
        while (temp <= N) {
            c++;
            x = x * i;
            temp = temp + x;
        }
        
        i++;
    }
    
    std::cout << c << std::endl;
    return 0;
}
// OUTPUT
// Invocation failed [TIME_LIMIT_EXCEEDED]

// Runtime error: exit code is -1
// =====
// Used: 15000 ms, 0 KB

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By imtheonly1, history, 13 months ago, In English

I am a Specialist.

Need help moving forward.

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it