# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
445944 | Jasiekstrz | Knjige (COCI20_knjige) | C++17 | 5 ms | 1484 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
const int N=1e5;
int h[2]={-1,-1};
vector<int> st[2];
vector<string> ans;
void take(bool hand,bool shelf)
{
h[hand]=st[shelf].back();
st[shelf].pop_back();
ans.push_back((string)"UZMI "+(hand ? "D":"L")+" "+(shelf ? "D":"L"));
return;
}
void put(bool hand,bool shelf)
{
st[shelf].push_back(h[hand]);
h[hand]=-1;
ans.push_back((string)"STAVI "+(hand ? "D":"L")+" "+(shelf ? "D":"L"));
return;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
st[0].resize(n);
for(int i=1;i<=n;i++)
cin>>st[0][n-i];
while(!st[0].empty())
{
take(0,0);
put(0,1);
}
for(int i=0;i<n;i++)
{
take(0,1);
while(!st[1].empty())
{
if(st[1].back()>h[0])
{
put(0,0);
take(0,1);
}
else
{
take(1,1);
put(1,0);
}
}
while(st[0].size()>i)
{
take(1,0);
put(1,1);
}
put(0,0);
}
cout<<ans.size()<<"\n";
for(auto v:ans)
cout<<v<<"\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |