結果

問題 No.9 モンスターのレベル上げ
ユーザー SugihaMSugihaM
提出日時 2020-04-18 11:35:58
言語 C
(gcc 11.2.0)
結果
AC  
実行時間 3,734 ms / 5,000 ms
コード長 583 bytes
コンパイル時間 108 ms
使用メモリ 2,008 KB
最終ジャッジ日時 2022-11-27 12:08:53
合計ジャッジ時間 26,245 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
1,952 KB
testcase_01 AC 1 ms
1,872 KB
testcase_02 AC 2,663 ms
1,884 KB
testcase_03 AC 1,856 ms
1,864 KB
testcase_04 AC 768 ms
1,812 KB
testcase_05 AC 429 ms
1,892 KB
testcase_06 AC 98 ms
1,972 KB
testcase_07 AC 1 ms
1,912 KB
testcase_08 AC 149 ms
1,968 KB
testcase_09 AC 2,534 ms
1,916 KB
testcase_10 AC 0 ms
1,912 KB
testcase_11 AC 3,128 ms
1,812 KB
testcase_12 AC 3,734 ms
1,864 KB
testcase_13 AC 2,603 ms
1,968 KB
testcase_14 AC 2,537 ms
1,816 KB
testcase_15 AC 2,248 ms
1,868 KB
testcase_16 AC 9 ms
1,868 KB
testcase_17 AC 1,203 ms
2,008 KB
testcase_18 AC 935 ms
1,856 KB
testcase_19 AC 5 ms
1,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<math.h>

int main(){
	int a[1500],b[1500],e[1500],i,j,k,n,l,m,ans;
	scanf("%d",&n);
	for(i = 0;i < n; i++){
    scanf("%d", a+i);
  }
	for(i=0;i<n;i++){
    scanf("%d", b+i);
  }
	ans = n;
	for(i = 0;i < n;i++){
		for(j = 0;j < n;j++){
      e[j] = a[j] * 2000;
    }
		for(j = 0;j < n;j++){
			for(l = k = 0;k < n; k++){
        if(e[k] < e[l]){
          l = k;
        }
      }
      e[l] += b[(i+j)%n]/2*2000+1;
		}
		for(m = j= 0;j < n;j++){
      m = fmax(m,e[j]%2000);
    }
		if(ans > m){
      ans = m;
    }
	}
	printf("%d\n",ans);
	return 0;
}
0