結果
| 問題 |
No.935 う し た ぷ に き あ く ん 笑 ビ - ム
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2021-02-04 20:05:19 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 720 bytes |
| コンパイル時間 | 856 ms |
| コンパイル使用メモリ | 31,872 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-01 01:05:04 |
| 合計ジャッジ時間 | 2,159 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 58 |
コンパイルメッセージ
main.c:7:1: warning: data definition has no type or storage class
7 | a[2000];
| ^
main.c:7:1: warning: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:8:1: warning: data definition has no type or storage class
8 | b[2004];
| ^
main.c:8:1: warning: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
main.c:12:1: warning: return type defaults to 'int' [-Wimplicit-int]
12 | main(){
| ^~~~
main.c: In function 'main':
main.c:51:17: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
51 | printf("%d\n",u);
| ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
+++ |+#include <stdio.h>
1 | #pragma GCC optimize("Ofast")
main.c:51:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
51 | printf("%d\n",u);
| ^~~~~~
main.c:51:17: note: include '<stdio.h>' or provide a declaration of 'printf'
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
char*mmap();
#define RD(v) int v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
a[2000];
b[2004];
#define M 1000000000
main(){
char*rp=mmap(0l,1l<<28,1,2,0,0ll);
RD(n);
for(int i=1;i<n+1;++i){
b[i]=M+1;
}
char*s=rp;
rp+=n+1;
for(int i=0;i<n;++i){
RD(t);
a[i]=t;
if(s[i]=='E'){
#if 1
if(b[i]==i){
b[i+1]=i+t;
continue;
}
#endif
int k=0,v=0;
for(int j=i;j>=0;--j){
v+=a[j];
if(v>M){
break;
}
if(s[j]=='E'){
++k;
b[k]=b[k]<v?b[k]:v;
}
}
}
}
while(*rp++>=48);
do{
RD(k);
int u=0,v=n+1;
while(u+1<v){
int w=u+v>>1;
b[w]>k?(v=w):(u=w);
}
printf("%d\n",u);
}while(*rp);
}
tails