Submission #1104187

#TimeUsernameProblemLanguageResultExecution timeMemory
1104187melody_rulesKnjige (COCI20_knjige)C++17
50 / 50
20 ms972 KiB
#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 (stderr)

Main.cpp: In function 'int main()':
Main.cpp:10:7: warning: unused variable 'b' [-Wunused-variable]
   10 |   int b=0;
      |       ^
#Verdict Execution timeMemoryGrader output
Fetching results...