結果
| 問題 |
No.930 数列圧縮
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-22 22:25:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 2,000 ms |
| コード長 | 488 bytes |
| コンパイル時間 | 490 ms |
| コンパイル使用メモリ | 64,120 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 04:07:25 |
| 合計ジャッジ時間 | 2,766 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
int N;
int A[1<<17];
bool F[1<<17];
main()
{
cin>>N;
for(int i=0;i<N;i++)cin>>A[i];
if(A[0]>A[N-1])
{
cout<<"No"<<endl;
return 0;
}
cout<<"Yes"<<endl;
int T=A[N-1];
F[N-1]=true;
for(int i=N-2;i>=0;i--)
{
if(T<A[i])
{
T=A[i];
F[i]=true;
}
}
int id=0,pre=1,flag=0;
while(id<N)
{
while(!F[id])id++;
for(int j=id-1;j>=pre;j--)cout<<(flag++?" ":"")<<A[j];
cout<<(flag++?" ":"")<<A[id];
pre=id+=1;
}
cout<<endl;
}