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

Автор imtheonly1, история, 3 месяца назад, По-английски

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.

Полный текст и комментарии »

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

Автор imtheonly1, история, 3 месяца назад, По-английски

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://codeforces.me/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

Полный текст и комментарии »

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

Автор imtheonly1, история, 11 месяцев назад, По-английски

I am a Specialist.

Need help moving forward.

Полный текст и комментарии »

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