void test() { // LRUCache * one = new LRUCache(1); // one->set(2,1); // cout << one->get(2) << endl; // one->set(3,2); // cout << one->get(2) << endl; // cout << one->get(3) << endl; // // one = new LRUCache(2); // one->set(2,1); // one->set(1,1); // cout << one->get(2) << endl; // one->set(4,1); // cout << one->get(1) << endl; // cout << one->get(2) << endl; LRUCache *one = new LRUCache(2); one->set(2,1); one->set(3,2); cout << one->get(3) << endl; cout << one->get(2) << endl; one->set(4,3); cout << one->get(2) << endl; cout << one->get(3) << endl; cout << one->get(4) << endl; }
int main(int argc, char const *argv[]) { LRUCache *cache = new LRUCache(1); cache->set(2, 1); cout<<cache->get(2)<<endl; cache->set(3, 2); cout<<cache->get(2)<<endl; cout<<cache->get(3)<<endl; return 0; }
int main(){ LRUCache* lru = new LRUCache(2); lru->set(2,1); lru->set(1,1); cout << lru->get(2); lru->set(4,1); cout << lru->get(1); cout << lru->get(2); }
int main() { int t; cin>>t; while(t--) { int n; cin>>n; LRUCache *l = new LRUCache(n); int q; cin>>q; for(int i=0;i<q;i++) { string a; cin>>a; if(a=="SET") { int aa,bb; cin>>aa>>bb; l->set(aa,bb); }else if(a=="GET") { int aa; cin>>aa; cout<<l->get(aa)<<" "; }
int main(){ LRUCache *lru = new LRUCache(1); lru->set(1,1); lru->set(2,2); cout << lru->get(1)<< endl; return 1; }