# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1079263 | vnm06 | JOIRIS (JOI16_joiris) | C++14 | 1 ms | 600 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
int n, k, h[64];
vector<pair<int, int> > moves;
void print_ans(bool t)
{
if(!t)
{
cout<<-1<<endl;
return;
}
cout<<moves.size()<<endl;
for(int i=0; i<moves.size(); i++) cout<<moves[i].first<<" "<<moves[i].second+1<<endl;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>k;
for(int i=0; i<n; i++) cin>>h[i];
for(int i=n-2; i>=0; i--)
{
while(h[i]<h[i+1])
{
moves.push_back({1, i});
h[i]+=2;
}
}
int id=n-1, br=0;
for(int i=h[n-1]+1; i<=h[0]; i++)
{
while(id && h[id-1]<i) id--;
if((n-1-id)%2==0) br++;
for(int j=id; j<=n-2; j+=2) moves.push_back({2, j});
}
while(br>1)
{
moves.push_back({1, n-1});
br-=2;
}
if(!br) print_ans(1);
else if(br && n%2==0) print_ans(0);
else
{
moves.push_back({1, n-1});
for(int i=n-3; i>=0; i-=2) moves.push_back({2, i});
print_ans(1);
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |