結果
| 問題 | No.930 数列圧縮 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-22 22:23:36 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 490 bytes |
| 記録 | |
| コンパイル時間 | 567 ms |
| コンパイル使用メモリ | 64,128 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 04:05:41 |
| 合計ジャッジ時間 | 4,783 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 WA * 12 |
コンパイルメッセージ
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-1)
{
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;
}