?
# | Author | Problem | Lang | Verdict | Time | Memory | Sent | Judged | |
---|---|---|---|---|---|---|---|---|---|
105567563 |
Practice: harshit_1010 |
1468C - 34 | C++14 (GCC 6-32) | Time limit exceeded on test 17 | 5000 ms | 35524 KB | 2021-01-27 14:51:15 | 2021-01-27 14:51:17 |
/** -------------> harshit_1010 **/ /// TEMPLATE STARTED ///// // Neeche to dekho // ///HEADER FILES/// #include <bits/stdc++.h> #include <cstdio> #include <cstring> #include <cmath> #include <cctype> #include <stack> #include <queue> #include <vector> #include <string> #include <map> #include <set> #include <iostream> #include <algorithm> #include <sstream> #include <cstdlib> #include <complex> #include <iomanip> #include <utility> #include <bitset> #include <list> #include <assert.h> #include <numeric> #include <fstream> using namespace std; //#include <ext/pb_ds/assoc_container.hpp> //using namespace __gnu_pbds; //typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; //USAGE s.order_of_key(val) its expected position (int)in set // s.find_by_order(index); 0 based //find_by_order returns an( iterator )to //the element at a given position ///DEFINES/// #define ff first #define ss second #define ull unsigned long long int #define ll long long int #define ar array #define type(x) typeid(x).name() #define vi vector<int> #define pii pair<int,int> #define pll pair<ll,ll> #define vll vector<ll> #define nmvi(v,n,m) vector<vector<int>> v(n,vector<int>(m)); _fr(i,n) _fr(j,m) v[i][j] = 0; #define MOD ((ll)(1e9+7)) #define endl "\n" #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define FASTIO ios::sync_with_stdio(0); cin.tie(0) #define check(x) cout<<"CHECK = "<<#x<<"\n"; #define MID(a,b) (a+(b-a)/2) #define mine(b) *min_element(all(b)) #define maxe(b) *max_element(all(b)) #define mini(b) min_element(all(b))-b.begin() #define maxi(b) max_element(all(b))-b.begin() #define sz(a) int((a).size()) #define present(c, element) (c.find(element) != c.end()) #define _fr(i,n) for(int i=0;i<n;i++) // for_loop #define _frr(i,a,b) for(int i=a;i<=b;i++) // for_range #define _rf(i,b,a) for(int i=b;i>=a;i--) // reverse for_range #define write(a) for(auto x: a) cout << x << ' ';cout << endl; #define fail(a) {cout<<#a<<endl;return;} #define pass(a) {cout<<#a<<endl;return;} #define output(a) cout << a << endl; #define next cout<<endl; #define rnext return"\n"; #define rsort(a,n) sort(a,a+n,greater<ll>()); /// CONSTANTS /// const int INF = (int) INT_MAX; const long long INF64 = (long long) 1e18; const long double eps = 1e-9; const long double pi = 3.14159265358979323846; double PHI = 1.6180339; ///TEMPLATES/// template<class T1>void deb(T1 e) { cout <<"-->"<< e << endl; } template<class T1, class T2> void deb(T1 e1, T2 e2) { cout <<"-->"<< e1 << " " << e2 << endl; } template<class T1, class T2, class T3> void deb(T1 e1, T2 e2, T3 e3) { cout <<"-->"<< e1 << " " << e2 << " " << e3 << endl; } template<class T1, class T2, class T3, class T4> void deb(T1 e1, T2 e2, T3 e3, T4 e4) { cout <<"-->"<< e1 << " " << e2 << " " << e3 << " " << e4 << endl; } // Errichto debugger #define sim template < class c #define ris return * this #define dor > debug & operator << #define eni(x) sim > typename \ enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) { sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...); struct debug { #ifdef LOCAL ~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; } #else sim dor(const c&) { ris; } #endif }; #define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] " //debug & operator << (debug & dd, P p) { dd << "(" << p.x << ", " << p.y << ")"; return dd; } // Errichto debugger ends void read(vector<int> &v) { int N = (int)v.size(); for(int i=0; i<N; i++) { cin >> v[i]; } } // UNCOMMENT FOR GRAPHS //const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1}; //const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1}; //bool e(int i, int j) { //return i>=0 && j>=0 && i<n && j<m; //} /// TEMPLATE OVER /// ///----------ANSWER -------------------------------/// bool isprime(ll n) { if (n == 1)return false; ll i = 2; while (i*i <= n){ if (n % i == 0) return false; i += 1; } return true; } //ll Answer() int main() { FASTIO; ll t = 1,i=0,j=1; cin>>t; multiset<ll,greater<ll>>m; multiset<pll>v; while(t--) { //cout<<Answer()<<endl; //Answer(); int c; cin>>c; if(c==1) { ll p; cin>>p; v.insert(make_pair(j,p)); m.insert(p); j++; } else if(c==2) { //while(v[i]==-1)i++; printf("%d ",((*v.begin()).ff)); m.erase(m.find((*v.begin()).ss)); v.erase(v.begin()); } else { //ll z=0; auto it=v.begin(); for(;it!=v.end();it++) if((*it).ss==(*m.begin()))break; //ll z=distance(v.begin(),it); m.erase(m.begin()); printf("%d ",((*it).ff)); v.erase(it); } } //for(auto it=ans.begin();it!=ans.end();it++) // cout<<*it<<" "; //next; printf("\n"); return 0; }
?
?
?
?