結果

問題 No.9 モンスターのレベル上げ
ユーザー SugihaMSugihaM
提出日時 2020-04-18 11:35:58
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 2,658 ms / 5,000 ms
コード長 583 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 32,896 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 20:39:15
合計ジャッジ時間 24,250 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2,654 ms
6,944 KB
testcase_03 AC 1,840 ms
6,944 KB
testcase_04 AC 752 ms
6,940 KB
testcase_05 AC 418 ms
6,940 KB
testcase_06 AC 93 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 142 ms
6,944 KB
testcase_09 AC 2,513 ms
6,940 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 2,658 ms
6,940 KB
testcase_12 AC 2,645 ms
6,940 KB
testcase_13 AC 2,636 ms
6,944 KB
testcase_14 AC 2,508 ms
6,940 KB
testcase_15 AC 2,231 ms
6,944 KB
testcase_16 AC 8 ms
6,940 KB
testcase_17 AC 1,177 ms
6,940 KB
testcase_18 AC 919 ms
6,940 KB
testcase_19 AC 4 ms
6,940 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