結果
| 問題 | No.1211 円環はお断り |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2022-10-25 19:03:24 |
| 言語 | C90 (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,031 bytes |
| 記録 | |
| コンパイル時間 | 90 ms |
| コンパイル使用メモリ | 26,292 KB |
| 最終ジャッジ日時 | 2026-02-24 01:10:51 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'f':
main.c:6:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
6 | #define rep(v,e) for(long v=0;v<e;++v)
| ^~~
main.c:18:9: note: in expansion of macro 'rep'
18 | rep(i,n){
| ^~~
main.c:6:18: note: use option '-std=c99', '-std=gnu99', '-std=c11' or '-std=gnu11' to compile your code
6 | #define rep(v,e) for(long v=0;v<e;++v)
| ^~~
main.c:18:9: note: in expansion of macro 'rep'
18 | rep(i,n){
| ^~~
main.c:28:14: error: redefinition of 'i'
28 | rrep(i,n){
| ^
main.c:7:28: note: in definition of macro 'rrep'
7 | #define rrep(v,e) for(long v=e;v--;)
| ^
main.c:18:13: note: previous definition of 'i' with type 'long int'
18 | rep(i,n){
| ^
main.c:6:27: note: in definition of macro 'rep'
6 | #define rep(v,e) for(long v=0;v<e;++v)
| ^
main.c:7:19: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
7 | #define rrep(v,e) for(long v=e;v--;)
| ^~~
main.c:28:9: note: in expansion of macro 'rrep'
28 | rrep(i,n){
| ^~~~
main.c: In function 'f0':
main.c:6:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
6 | #define rep(v,e) for(long v=0;v<e;++v)
| ^~~
main.c:48:9: note: in expansion of macro 'rep'
48 | rep(i,n){
| ^~~
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define wt(v) {unsigned long _z=v;do*--wp=_z%10+48;while(_z/=10);}
#define rep(v,e) for(long v=0;v<e;++v)
#define rrep(v,e) for(long v=e;v--;)
long n,k;
int a[100000];
int c[100000];
int d[100000];
int e[100000];
int f(long m){
long j=0;
long s=0;
rep(i,n){
while(s<m){
s+=a[j++%n];
if(j-i>n){
return 0;
}
}
c[i]=j;
s-=a[i];
}
rrep(i,n){
if(c[i]>=n){
d[i]=1;
e[i]=c[i]-n;
}else{
d[i]=1+d[c[i]];
e[i]=e[c[i]];
}
if(d[i]==k&&e[i]<=i){
return 1;
}
}
return 0;
}
void f0(){
char*mmap();
char*rp=mmap(0l,1l<<25,1,2,0,0ll);
n=rd();
k=rd();
rep(i,n){
a[i]=rd();
}
}
long f1(){
long g=1;
long h=100000000000001l;
while(g+1<h){
long m=g+h>>1;
if(f(m)){
g=m;
}else{
h=m;
}
}
return g;
}
void f2(long z){
char wbuf[64],*wp=wbuf+sizeof wbuf;
wt(z);
write(1,wp,wbuf+sizeof wbuf-wp);
}
int main(){
f0();
f2(f1());
_exit(0);
}
tails