| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 475227 | Beboo44 | Knjige (COCI20_knjige) | C++14 | 35 ms | 1484 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
