結果
| 問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム | 
| コンテスト | |
| ユーザー |  tails | 
| 提出日時 | 2021-02-04 19:30:47 | 
| 言語 | C (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 717 bytes | 
| コンパイル時間 | 262 ms | 
| コンパイル使用メモリ | 32,640 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-07-01 00:38:44 | 
| 合計ジャッジ時間 | 1,998 ms | 
| ジャッジサーバーID (参考情報) | judge5 / 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:48:17: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   48 |                 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:48:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   48 |                 printf("%d\n",u);
      |                 ^~~~~~
main.c:48: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'){
			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;
				}
			}
		}
	}
	for(int i=n-1;i>=0;--i){
		b[i]=b[i]<b[i+1]?b[i]:b[i+1];
	}
	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);
}
            
            
            
        