ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

Memory exceeded
Posted by Ankita 13 Nov 2014 22:29
Hi,
This is my code:

#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
vector<int> V;
V.resize(0);
int n;

cin >> n;
while( n != EOF) {
    V.resize(V.size() + 1);
    V.push_back(n);
    cin >> n;
}

cout << setprecision(4) << fixed ;
while(V.size() > 0) {
n  = V.back();
V.pop_back();
cout << sqrt(n) << endl;
}

return 0;
}

Could someone please tell me why the memory got exceeded here ? The stream is just 256 KB, right ?

Regards,
Ankita