結果
| 問題 |
No.2779 Don't make Pair
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2024-06-10 10:14:03 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,132 bytes |
| コンパイル時間 | 452 ms |
| コンパイル使用メモリ | 27,648 KB |
| 最終ジャッジ日時 | 2025-01-01 21:02:43 |
| 合計ジャッジ時間 | 1,139 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'main':
main.c:35:13: error: expected ';' before 'i'
35 | rep(i,n){
| ^
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:35:13: error: 'i' undeclared (first use in this function)
35 | rep(i,n){
| ^
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:35:13: note: each undeclared identifier is reported only once for each function it appears in
35 | rep(i,n){
| ^
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:56:14: error: expected ';' before 'i'
56 | reps(i,l,r){
| ^
main.c:8:35: note: in definition of macro 'reps'
8 | #define reps(v,s,e) for(typeof(e) v=s;v<e;++v)
| ^
ソースコード
#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() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define wt(v) {unsigned _z=v,_n=0;long _d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(long*)wp=_d;wp+=_n;}
#define rep(v,e) for(typeof(e) v=0;v<e;++v)
#define reps(v,s,e) for(typeof(e) v=s;v<e;++v)
#define chmin(v,a) (v=v<=a?v:a)
#define chmax(v,a) (v=v>=a?v:a)
#define HASH_BITS 18
#define HASH_N (1<<HASH_BITS)
#define HASH_MASK (HASH_N-1)
unsigned hash[HASH_N];
int hash_find(unsigned x){
int h=x&HASH_MASK;
while(1){
if(hash[h]==0||hash[h]==x){
return h;
}
h=h+1&HASH_MASK;
}
}
int b[HASH_N];
char wbuf[1<<25];
int main(){
rd_init();
int n=rd();
int l=0;
int r=n-1;
rep(i,n){
unsigned a=rd();
int h=hash_find(a);
if(!hash[h]){
hash[h]=a;
}else{
chmin(r,i);
chmax(l,b[h]);
}
b[h]=i;
}
if(l>=r){
write(1,"0\n\n",3);
_exit(0);
}
char*wp=wbuf;
{
unsigned v=r-l;
wt(v);
}
*wp++='\n';
reps(i,l,r){
unsigned v=i+1;
wt(v);
*wp++=' ';
}
write(1,wbuf,wp-wbuf);
_exit(0);
}
tails