Submission #866107

#TimeUsernameProblemLanguageResultExecution timeMemory
866107vnm06The Potion of Great Power (CEOI20_potion)C++14
0 / 100
39 ms262144 KiB
#include<bits/stdc++.h> using namespace std; int my_n, my_h[1000005]; void init(int N, int D, int H[]) { ///my_n=N; ///for(int i=0; i<my_n; i++) my_h[i]=H[i]; } map<pair<int, int>, int> my_globalmp; set<pair<int, int> > my_st[8000000]; void my_update(int v, int le, int ri, int be, int en, int st1, int st2) { if(le>en || ri<be) return; if(be<=le && ri<=en) { my_st[v].insert({st1, st2}); my_st[v].insert({st2, st1}); return; } int mid=(le+ri)/2; my_update(2*v, le, mid, be, en, st1, st2); my_update(2*v+1, mid+1, ri, be, en, st1, st2); } void curseChanges(int U, int A[], int B[]) { ///for(int i=0; i<U-1; i++) { ////if(A[i]>B[i]) swap(A[i], B[i]); ///map<pair<int, int>, int>::iterator it=globalmp.find({A[i], B[i]}); ///if(it!=globalmp.end()) { ///update(1, 0, 2e5+1, (*it).second, i, A[i], B[i]); ///globalmp.erase(it); } ///else { ///globalmp.insert({{A[i], B[i]}, i+1}); } } /// map<pair<int, int>, int>::iterator it=globalmp.begin(); ///while(it!=globalmp.end()) ///{ ///update(1, 0, 2e5+1, (*it).second, U, (*it).first.first, (*it).first.second); /// it++; /// } } vector<int> my_vect[2]; void my_query(int v, int le, int ri, int day, int ch, int id) { if(le<=day && day<=ri) { set<pair<int, int> >::iterator it=my_st[v].lower_bound({ch, -1}); while(it!=my_st[v].end()) { if((*it).first!=ch) break; my_vect[id].push_back((*it).second); it++; } } if(le==ri) return; int mid=(le+ri)/2; if(day<=mid) my_query(2*v, le, mid, day, ch, id); else my_query(2*v+1, mid+1, ri, day, ch, id); } int question(int x, int y, int v) { ///my_vect[0].resize(0); ///my_vect[1].resize(0); /**query(1, 0, 2e5+1, v, x, 0); query(1, 0, 2e5+1, v, y, 1); int s1=vect[0].size(), s2=vect[1].size(), id1=0, id2=0; for(int i=0; i<s1; i++) vect[0][i]=h[vect[0][i]]; for(int i=0; i<s2; i++) vect[1][i]=h[vect[1][i]]; sort(vect[0].begin(), vect[0].end()); sort(vect[1].begin(), vect[1].end()); int tekd=1e9; while(id1<s1 && id2<s2) { int dist=vect[0][id1]-vect[1][id2]; if(dist<0) { id1++; dist=-dist; if(dist<tekd) tekd=dist; } else { id2++; if(dist<tekd) tekd=dist; } }*/ return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...