結果
| 問題 | No.2427 Tree Distance Two |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2023-08-21 13:29:49 |
| 言語 | C90(gcc15) (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 860 bytes |
| 記録 | |
| コンパイル時間 | 176 ms |
| コンパイル使用メモリ | 26,168 KB |
| 最終ジャッジ日時 | 2026-02-24 01:15:48 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'main':
main.c:21:13: error: expected ';' before 'j'
21 | rep(j,n-1<<1){
| ^
main.c:7:32: note: in definition of macro 'rep'
7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c:21:13: error: 'j' undeclared (first use in this function)
21 | rep(j,n-1<<1){
| ^
main.c:7:36: note: in definition of macro 'rep'
7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c:21:13: note: each undeclared identifier is reported only once for each function it appears in
21 | rep(j,n-1<<1){
| ^
main.c:7:36: note: in definition of macro 'rep'
7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c:26:21: error: expected ';' before 'i'
26 | rep(i,n+1){
| ^
main.c:7:32: note: in definition of macro 'rep'
7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c:26:21: error: 'i' undeclared (first use in this function)
26 | rep(i,n+1){
| ^
main.c:7:36: note: in definition of macro 'rep'
7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
| ^
main.c:30:14: error: expected ';' before 'j'
30 | rrep(j,n-1<<1){
| ^
main.c:8:33: note: in definition of macro 'rrep'
8 | #define rrep(v,e) for(typeof(e) v=e;v--;)
| ^
main.c:34:14: error: expected ';' before 'i'
34 | rrep(i,n){
| ^
main.c:8:33: note: in definition of macro 'rrep'
8 | #define rrep(v,e) for(typeof(e) v=e;v--;)
| ^
main.c:36:23: error: expected ';' before 'k'
36 | rrep3(k,en[i],en[i+1]){
| ^
main.c:9:36: note: in definition of macro
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);})
#define rd() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define wt(v) ({unsigned _z=v;do*--wp=_z%10+48;while(_z/=10);})
#define rep(v,e) for(typeof(e) v=0;v<e;++v)
#define rrep(v,e) for(typeof(e) v=e;v--;)
#define rrep3(v,s,e) for(typeof(e) v=e;--v>=s;)
#define MAXN 300000
int en[MAXN+2];
int eb[MAXN<<1];
int uv[MAXN<<1];
char wbuf[1<<25];
int main(){
rd_init();
long n=rd();
rep(j,n-1<<1){
++en[uv[j]=rd()-1];
}
{
int s=0;
rep(i,n+1){
en[i]=s+=en[i];
}
}
rrep(j,n-1<<1){
eb[--en[uv[j]]]=uv[j^1];
}
char*wp=wbuf+sizeof wbuf;
rrep(i,n){
int z=0;
rrep3(k,en[i],en[i+1]){
long j=eb[k];
z+=en[j+1]-en[j]-1;
}
*--wp='\n';
wt(z);
}
write(1,wp,wbuf+sizeof wbuf-wp);
_exit(0);
}
tails