Submission #288093

#TimeUsernameProblemLanguageResultExecution timeMemory
288093ToMmyDongLast supper (IOI12_supper)C++11
9 / 100
568 ms20648 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define ALL(i) i.begin(), i.end() #define SZ(i) int(i.size()) #define X first #define Y second #ifdef tmd #define debug(...) fprintf(stderr,"#%d-(%s)=",__LINE__,#__VA_ARGS__);_do(__VA_ARGS__); template<typename T> void _do(T &&x){cerr<<x<<endl;} template<typename T, typename ...S> void _do(T &&x, S &&...y) {cerr<<x<<",";_do(y...);} template<typename IT> ostream& __printRng (ostream& os, IT bg, IT ed) { for (IT it=bg;it!=ed;it++) { if (it == bg) os << "{" << *it; else os << "," << *it; } return os << "}"; } template<typename T> ostream& operator << (ostream& os, const vector<T> &vec) { return __printRng(os, ALL(vec)); } template<typename T, typename S> ostream& operator << (ostream& os, const pair<T,S> &pa) { return os << "{" << pa.X << "," << pa.Y << "}"; } #else #define debug(...) #endif #include "advisor.h" void ComputeAdvice(int *C, int N, int K, int M) { for (int i=0; i<N; i++) { for (int j=0; j<20; j++) { WriteAdvice((C[i]>>j)&1); } } }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; #define ALL(i) i.begin(), i.end() #define SZ(i) int(i.size()) #define X first #define Y second #ifdef tmd #define debug(...) fprintf(stderr,"#%d-(%s)=",__LINE__,#__VA_ARGS__);_do(__VA_ARGS__); template<typename T> void _do(T &&x){cerr<<x<<endl;} template<typename T, typename ...S> void _do(T &&x, S &&...y) {cerr<<x<<",";_do(y...);} template<typename IT> ostream& __printRng (ostream& os, IT bg, IT ed) { for (IT it=bg;it!=ed;it++) { if (it == bg) os << "{" << *it; else os << "," << *it; } return os << "}"; } template<typename T> ostream& operator << (ostream& os, const vector<T> &vec) { return __printRng(os, ALL(vec)); } template<typename T, typename S> ostream& operator << (ostream& os, const pair<T,S> &pa) { return os << "{" << pa.X << "," << pa.Y << "}"; } #else #define debug(...) #endif #include "assistant.h" void Assist(unsigned char *a, int n, int k, int r) { vector<int> c(n); for (int i=0, ptr=0; i<n; i++) { for (int j=0; j<20; j++) { if (a[ptr++]) c[i] += (1<<j); } } vector<int> nxt(n); vector<int> lst(n, n); for (int i=n-1; i>=0; i--) { nxt[i] = lst[c[i]]; lst[c[i]] = i; } set<pii> pq; set<int> st; for (int i=0; i<k; i++) { pq.emplace(pii(lst[i], i)); st.insert(i); debug(lst[i], i); } for (int i=0; i<n; i++) { int req = GetRequest(); assert(c[i] == req); if (!st.count(req)) { pii cur = *prev(pq.end()); pq.erase(prev(pq.end())); debug(cur); debug(nxt[i], req); PutBack(cur.Y); st.erase(cur.Y); st.insert(req); pq.emplace(nxt[i], req); } else { pq.erase({i, req}); pq.emplace(nxt[i], req); } } }
#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...