結果
| 問題 | No.3134 二分探索木 |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2025-05-04 23:19:54 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 858 bytes |
| 記録 | |
| コンパイル時間 | 562 ms |
| コンパイル使用メモリ | 80,496 KB |
| 最終ジャッジ日時 | 2026-01-04 01:51:23 |
| 合計ジャッジ時間 | 1,981 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:9:22: error: 'typeof' was not declared in this scope; did you mean 'typedef'?
9 | #define rep(v,e) for(typeof(e)v=0;v<e;++v)
| ^~~~~~
main.cpp:38:9: note: in expansion of macro 'rep'
38 | rep(k,n){
| ^~~
main.cpp:38:13: error: 'k' was not declared in this scope
38 | rep(k,n){
| ^
main.cpp:9:35: note: in definition of macro 'rep'
9 | #define rep(v,e) for(typeof(e)v=0;v<e;++v)
| ^
main.cpp:9:22: error: 'typeof' was not declared in this scope; did you mean 'typedef'?
9 | #define rep(v,e) for(typeof(e)v=0;v<e;++v)
| ^~~~~~
main.cpp:49:9: note: in expansion of macro 'rep'
49 | rep(k,n){
| ^~~
main.cpp:49:13: error: 'k' was not declared in this scope
49 | rep(k,n){
| ^
main.cpp:9:35: note: in definition of macro 'rep'
9 | #define rep(v,e) for(typeof(e)v=0;v<e;++v)
| ^
ソースコード
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2")
#include <unistd.h>
#include <sys/mman.h>
#include <algorithm>
#include <map>
#define rep(v,e) for(typeof(e)v=0;v<e;++v)
char*rp,*wp;
char wbuf[1<<25];
int c[200000];
static inline
int rd(){
int _v=0,_c;
while(_c=*rp++-48,_c>=0)_v=_v*10+_c;
return _v;
}
static inline
void wt(int v){
unsigned _z=v,_n=0;
long _d=0;
while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);
*(long*)wp=_d;
wp+=_n;
}
int main(){
rp=static_cast<char*>(mmap(0,1<<25,1,2,0,0));
wp=wbuf;
std::map<int,int>m;
int n=rd();
m[0]=-1;
m[n+1]=-1;
rep(k,n){
int a=rd();
auto i=m.upper_bound(a);
auto j=prev(i);
int d=std::max(i->second,j->second)+1;
wt(d);
*wp++=' ';
m[a]=d;
c[k]=i->first-j->first-2;
}
wp[-1]='\n';
rep(k,n){
wt(c[k]);
*wp++=' ';
}
wp[-1]='\n';
write(1,wbuf,wp-wbuf);
_exit(0);
}
tails