Pagini recente » Cod sursa (job #1545195) | Cod sursa (job #1012558) | Cod sursa (job #2664020) | Cod sursa (job #3293647) | Cod sursa (job #2681342)
// Dijkstra.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <fstream>
#include <set>
#include <utility>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int n, a[200010], i, x, y, k;
set< pair<int, int> > s;
set< pair<int, int> >::iterator it;
int main() {
f >> n;
for (i = 1; i <= n; i++) {
f >> x;
if (x == 3) {
it = s.begin();
g << it->first << "\n";
}
else if (x == 2) {
f >> y;
s.erase(make_pair(a[y], y));
}
else {
f >> a[++k];
s.insert(make_pair(a[k], k));
}
}
return 0;
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file