結果
| 問題 | No.2221 Set X |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2023-02-23 18:48:15 |
| 言語 | C90 (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,374 bytes |
| 記録 | |
| コンパイル時間 | 144 ms |
| コンパイル使用メモリ | 26,292 KB |
| 最終ジャッジ日時 | 2026-02-24 01:12:34 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'f1':
main.c:7:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
7 | #define rep(v,e) for(int v=0;v<e;++v)
| ^~~
main.c:19:9: note: in expansion of macro 'rep'
19 | rep(i,n){
| ^~~
main.c:7:18: note: use option '-std=c99', '-std=gnu99', '-std=c11' or '-std=gnu11' to compile your code
7 | #define rep(v,e) for(int v=0;v<e;++v)
| ^~~
main.c:19:9: note: in expansion of macro 'rep'
19 | rep(i,n){
| ^~~
main.c: In function 'f2':
main.c:8:19: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
8 | #define rrep(v,e) for(int v=e;v--;)
| ^~~
main.c:28:9: note: in expansion of macro 'rrep'
28 | rrep(i,n-1){
| ^~~~
main.c:7:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
7 | #define rep(v,e) for(int v=0;v<e;++v)
| ^~~
main.c:36:17: note: in expansion of macro 'rep'
36 | rep(j,200001){
| ^~~
main.c:40:14: error: redefinition of 'i'
40 | rrep(i,n-1){
| ^
main.c:8:27: note: in definition of macro 'rrep'
8 | #define rrep(v,e) for(int v=e;v--;)
| ^
main.c:28:14: note: previous definition of 'i' with type 'int'
28 | rrep(i,n-1){
| ^
main.c:8:27: note: in definition of macro 'rrep'
8 | #define rrep(v,e) for(int v=e;v--;)
| ^
main.c:8:19: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
8 | #define rrep(v,e) for(int v=e;v--;)
| ^~~
main.c:40:9: note: in expansion of macro 'rrep'
40 | rrep(i,n-1){
| ^~~~
main.c: In function 'main':
main.c:67:17: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
67 | for(int x=1;++x
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#define getrp() ({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) ({ulong _z=v;do*--wp=_z%10+48;while(_z/=10);})
#define rep(v,e) for(int v=0;v<e;++v)
#define rrep(v,e) for(int v=e;v--;)
typedef unsigned long ulong;
int a[100000];
int ls[100000],rs[100000];
int es[100000],en[200001];
int f1(){
char*rp=getrp();
int n=rd();
rep(i,n){
a[i]=rd();
ls[i]=i;
rs[i]=i;
}
return n;
}
void f2(int n){
rrep(i,n-1){
int d=a[i+1]-a[i];
if(d<200000){
++en[d];
}
}
{
int t=0;
rep(j,200001){
en[j]=t+=en[j];
}
}
rrep(i,n-1){
int d=a[i+1]-a[i];
if(d<200000){
es[--en[d]]=i;
}
}
}
void f3(int bx,int bf){
char wbuf[64],*wp=wbuf+sizeof wbuf;
*--wp='\n';
wt(bf);
*--wp='\n';
wt(bx);
write(1,wp,wbuf+sizeof wbuf-wp);
}
int main(){
int bx;
int bf;
int n=f1();
f2(n);
bx=1;
bf=n*2;
{
int m=n;
int ei=0;
for(int x=1;++x<bf-1;){
while(ei<en[x+1]){
int i=es[ei++];
int l=ls[i];
int r=rs[i+1];
rs[l]=r;
ls[r]=l;
--m;
}
int f=m;
int o=(bf+x)/(x+1);
if(f>=o){
goto hoge;
}
for(int i=0;i<n;){
int r=rs[i];
f+=a[r]/x-a[i]/x;
if(f>=o){
goto hoge;
}
i=r+1;
}
bf=f*(x+1);
bx=x;
hoge:;
}
}
f3(bx,bf);
_exit(0);
}
tails