Submission #310006

#TimeUsernameProblemLanguageResultExecution timeMemory
310006amunduzbaev로봇 (IOI13_robots)C++14
0 / 100
3 ms692 KiB
#include "robots.h" #include <bits/stdc++.h> //#include "grader.cpp" using namespace std; const int N=1e6+5; const int N1=5e4+5; multiset< pair<int, int> >wt,st; vector< pair<int,int> >r; int solve(){ int ans=0; while(true){ ans++; for(auto x:r){ if(wt.size() == 0) break; int robot=x.first; int type=x.second; if(type == 0) { auto toy =wt.upper_bound({robot,0}); if(toy == wt.begin()) continue; toy--; int wtoy = (*toy).first; int stoy = (*toy).second; wt.erase( wt.find( {wtoy,stoy} ) ); st.erase( st.find( {stoy,wtoy} ) ); } if(type == 1) { auto toy=st.upper_bound({robot,0}); if(toy == st.begin()) continue; toy--; int wtoy = (*toy).first; int stoy = (*toy).second; wt.erase( wt.find( {wtoy,stoy} ) ); st.erase( st.find( {stoy,wtoy} ) ); } cout<<robot<<"\n"; } if(wt.size() == 0) break; } return ans; } int putaway(int a, int b, int t, int a1[], int b1[], int w[], int s[]) { for(int i=0;i<t;i++){ if(a&&b){ if(w[i]>=a1[a-1]&&s[i]>=b1[b-1]) return -1; }else if(a){ if(w[i]>=a1[a-1]) return -1; }else if(s[i]>=b1[b-1]) return -1; wt.insert({w[i],s[i]}); st.insert({s[i],w[i]}); } for(int i=0;i<a;i++) r.push_back({a1[i],0}); for(int i=0;i<b;i++) r.push_back({b1[i],1}); sort(r.rbegin(),r.rend()); int ans=solve(); return ans; } /* */
#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...