# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
475227 | 2021-09-21T14:43:08 Z | Beboo44 | Knjige (COCI20_knjige) | C++14 | 35 ms | 1484 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fast_io ios_base::sync_with_stdio(0); cin.tie(0) int main() { ios_base::sync_with_stdio(0) ; cin.tie(0) ; ll n; cin>>n; vector<ll>v(n); vector<ll>temp(n); for(int i=0; i<n; ++i){ cin>>v[i]; temp[i]=v[i]; } vector<string>ans; vector<ll>righshelf; sort(temp.rbegin(),temp.rend()); while(v.size()>0){ if(v[0]!=temp[0]){ ans.push_back("UZMI L L"); ans.push_back("STAVI L D"); righshelf.push_back(v[0]); v.erase(v.begin()); } else{ ans.push_back("UZMI D L"); v.erase(v.begin()); } } ans.push_back("STAVI D L"); temp.erase(temp.begin()); while(temp.size()>0){ while(righshelf.size()>0){ if(righshelf[righshelf.size()-1]!=temp[0]){ ans.push_back("UZMI L D"); ans.push_back("STAVI L L"); v.push_back(righshelf[righshelf.size()-1]); righshelf.erase(righshelf.begin()+righshelf.size()-1); } else{ ans.push_back("UZMI D D"); righshelf.erase(righshelf.begin()+righshelf.size()-1); } } while(v.size()>0){ ans.push_back("UZMI L L"); ans.push_back("STAVI L D"); righshelf.push_back(v[v.size()-1]); v.erase(v.begin()+v.size()-1); } ans.push_back("STAVI D L"); temp.erase(temp.begin()); } cout<<ans.size()<<endl; for(int i=0; i<ans.size(); ++i){ cout<<ans[i]<<endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 31 ms | 1484 KB | Cannot hold multiple books at one hand |
2 | Incorrect | 31 ms | 1484 KB | Cannot hold multiple books at one hand |
3 | Incorrect | 31 ms | 1484 KB | Cannot hold multiple books at one hand |
4 | Incorrect | 34 ms | 1484 KB | Cannot hold multiple books at one hand |
5 | Incorrect | 31 ms | 1484 KB | Cannot hold multiple books at one hand |
6 | Incorrect | 32 ms | 1484 KB | Cannot hold multiple books at one hand |
7 | Incorrect | 16 ms | 848 KB | Cannot hold multiple books at one hand |
8 | Incorrect | 32 ms | 1356 KB | Cannot hold multiple books at one hand |
9 | Incorrect | 32 ms | 1484 KB | Cannot hold multiple books at one hand |
10 | Incorrect | 35 ms | 1484 KB | Cannot hold multiple books at one hand |