|
|
вернуться в форумWhy Memory Limit Exceeded? Послано Grigor 18 июл 2005 00:03 can't figure out how this code exceeds memory limit. queue<int> Q; multiset<int, greater<int> > S; for (int i = 0; i < M; ++i) { int temp; cin >> temp; Q.push(temp); S.insert(temp); } while (true) { cout << *(S.begin()) << endl; int toRemove = Q.front(); Q.pop(); S.erase(S.find(toRemove)); int temp; cin >> temp; if (temp == -1) break; Q.push(temp); S.insert(temp); } |
|
|