# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1104187 | 2024-10-23T06:48:42 Z | melody_rules | Knjige (COCI20_knjige) | C++17 | 20 ms | 972 KB |
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { int n=0; int m=0; int a=0; int b=0; int i=0; int j=0; string s; cin>>n; vector<int> vec(n); vector<int> vecoo(n); vector<string> fin; for(i=0;i<n;i++) { cin>>a; vec.at(i) = a; vecoo.at(i) = a; } sort(vecoo.begin(), vecoo.end()); while(j < (n-1)) { m = vec.size(); for(i=0;i<m;i++) { if(vec.at(i) == vecoo.at(j)) break; s = "UZMI L L"; fin.push_back(s); s = "STAVI L D"; fin.push_back(s); } s = "UZMI D L"; fin.push_back(s); vec.erase(vec.begin() + i); a=i; for(;i>0;i--) { s = "UZMI L D"; fin.push_back(s); s = "STAVI L L"; fin.push_back(s); } s = "STAVI D D"; fin.push_back(s); j++; } cout<<fin.size() + 2*n - 2<<endl; for(auto x : fin) cout<<x<<endl; for(i=0;i<(n-1);i++) { cout<<"UZMI L D"<<endl; cout<<"STAVI L L"<<endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 972 KB | Output is correct |
2 | Correct | 15 ms | 972 KB | Output is correct |
3 | Correct | 15 ms | 972 KB | Output is correct |
4 | Correct | 15 ms | 972 KB | Output is correct |
5 | Correct | 15 ms | 972 KB | Output is correct |
6 | Correct | 20 ms | 972 KB | Output is correct |
7 | Correct | 10 ms | 716 KB | Output is correct |
8 | Correct | 15 ms | 972 KB | Output is correct |
9 | Correct | 18 ms | 972 KB | Output is correct |
10 | Correct | 15 ms | 972 KB | Output is correct |