codepasta's blog

By codepasta, 4 years ago, In English

helloo, codeforce!!!11!

problem statement is: given a and b, print a + b. a and b <= 1000000000

why is this problem giving ''time limit exceedded''?????

here is my submisssion:

#include <iostream>

using namespace std;

int main()

{

int a, b;

int i;

int answerr = 0;

cin >> a;

cin >> b; for (i = 1; i<=a; i = i + 1) answerr = answerr + 1; for (i = 1; i<=b; i = i + 1) answerr = answerr + 1; cout << answerr; return 0; }

pleasse helppp, thank you!!111!!

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

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

After seeing this post, I got a feeling why codeforces didn't have the report option.

»
4 years ago, # |
  Vote: I like it +4 Vote: I do not like it

That is a lie. It shouldn't get TLE. The reason for that is compiler optimizations. And as you declared a,b,i as integers not volatile integers, so it shouldn't timeout as compiler optimizes the loop to O(1) only. Now, stop lying greendian.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    That's a strong assumption to make given that we don't know what compiler he is using and whether optimisation is turned on or not.

»
4 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Smh. Fake news. It gets an AC in 0.00s.
Proof

»
4 years ago, # |
Rev. 4   Vote: I like it +26 Vote: I do not like it

Elo Sir. I sir had same issue. plz help???

include <bits/stdc++.h>

using namespace std;

define ll long long int

define SLOWIO sync_with_stdio(true); cout.tie(cin); cout.tie(cerr); cin.tie(cout); cin.tie(cerr); cerr.tie(cout); cerr.tie(cin);

int main() { SLOWIO ll a, b; cin >> a >> b; cout << "Is it rated?" << endl; return 0; }

may codeforce be with us!!!1!!111!