結果

問題 No.9 モンスターのレベル上げ
ユーザー nagakin0414nagakin0414
提出日時 2018-07-06 16:07:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 4,659 ms / 5,000 ms
コード長 1,662 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 32,128 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-11-11 23:01:56
合計ジャッジ時間 41,343 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 4,603 ms
6,676 KB
testcase_03 AC 3,224 ms
6,676 KB
testcase_04 AC 1,309 ms
6,676 KB
testcase_05 AC 727 ms
6,676 KB
testcase_06 AC 163 ms
6,676 KB
testcase_07 AC 1 ms
6,676 KB
testcase_08 AC 247 ms
6,676 KB
testcase_09 AC 4,334 ms
6,676 KB
testcase_10 AC 1 ms
6,676 KB
testcase_11 AC 4,302 ms
6,676 KB
testcase_12 AC 4,477 ms
6,676 KB
testcase_13 AC 4,659 ms
6,676 KB
testcase_14 AC 4,372 ms
6,676 KB
testcase_15 AC 3,855 ms
6,676 KB
testcase_16 AC 13 ms
6,676 KB
testcase_17 AC 2,053 ms
6,676 KB
testcase_18 AC 1,594 ms
6,676 KB
testcase_19 AC 7 ms
6,676 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
main.cpp:25:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |     scanf("%d",a+i);
      |     ~~~~~^~~~~~~~~~
main.cpp:28:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   28 |     scanf("%d",b+i);
      |     ~~~~~^~~~~~~~~~

ソースコード

diff #

/*HeliaRPGQ[ĂBRPGQ[͖̃X^[̃xグĂQ[i߂Q[łB
Helia͎莝NC̃X^[̃p[eB[ăxグƎvĂB

xグ́AG̃X^[11Ő킢AG̃x̔؂̂ĂlłBi̐X^[̃xɉZj
Ⴆ΁ÃX^[̃x1ő̃X^[̃x5̎A
ƁÃX^[̃x3ɂȂB
킢ɊւĂ̓ACegĂł‚߁AxɊ֌WȂĂƂB

ŁAG̃X^[~ɎvɕłāAŏɐ키X^[߂Ǝv̏ԂɑSƈx키ƂłꂪB
iŏɐ킦郂X^[͎RɑIׂj
HeliáA̎莝̃X^[̒AP했A̎ɈԃxႢAꍇ́AԐ킢ĂȂX^[킹ƂB
̎̃X^[Sē|ƂāA莝̃p[eB[Ő퓬񐔂ԑ񐔂ƂႭȂ悤ōŏɐ키X^[I񂾂ƂA̒ňԐ퓬񐔂߂ĂB*/


#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