結果

問題 No.9 モンスターのレベル上げ
ユーザー nagakin0414nagakin0414
提出日時 2018-07-06 16:11:36
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 2,664 ms / 5,000 ms
コード長 615 bytes
コンパイル時間 891 ms
コンパイル使用メモリ 30,284 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-13 18:09:10
合計ジャッジ時間 24,860 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2,662 ms
4,380 KB
testcase_03 AC 1,853 ms
4,376 KB
testcase_04 AC 757 ms
4,380 KB
testcase_05 AC 422 ms
4,376 KB
testcase_06 AC 93 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 143 ms
4,380 KB
testcase_09 AC 2,537 ms
4,384 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2,664 ms
4,380 KB
testcase_12 AC 2,663 ms
4,376 KB
testcase_13 AC 2,661 ms
4,376 KB
testcase_14 AC 2,533 ms
4,376 KB
testcase_15 AC 2,241 ms
4,376 KB
testcase_16 AC 8 ms
4,380 KB
testcase_17 AC 1,189 ms
4,380 KB
testcase_18 AC 923 ms
4,380 KB
testcase_19 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>

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