結果
| 問題 |
No.29 パワーアップ
|
| コンテスト | |
| ユーザー |
yn
|
| 提出日時 | 2014-11-25 18:46:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 574 bytes |
| コンパイル時間 | 139 ms |
| コンパイル使用メモリ | 29,064 KB |
| 実行使用メモリ | 17,352 KB |
| 最終ジャッジ日時 | 2025-10-24 20:51:08 |
| 合計ジャッジ時間 | 12,587 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d",&N);
| ~~~~~^~~~~~~~~
main.cpp:22:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
22 | scanf("%d",&a[i]);
| ~~~~~^~~~~~~~~~~~
main.cpp:18:22: warning: iteration 11 invokes undefined behavior [-Waggressive-loop-optimizations]
18 | up[i]=0;
| ~~~~~^~
main.cpp:16:18: note: within this loop
16 | for(i=0;i<=11;i++){
| ~^~~~
main.cpp:42:29: warning: iteration 10 invokes undefined behavior [-Waggressive-loop-optimizations]
42 | pup=pup+up[i]/2;
| ~~~~^
main.cpp:41:18: note: within this loop
41 | for(i=1;i<=11;i++){
| ~^~~~
ソースコード
#include<stdio.h>
int main(){
int N=0,M=0;
int i=0,j=0;
int pup=0;
int a[301];
int l[11];
int up[11];
int sp;
scanf("%d",&N);
M=N*3;
for(i=0;i<=11;i++){
a[i]=0;
up[i]=0;
}
for(i=0;i<M;i++){
scanf("%d",&a[i]);
}
for(i=1;i<=10;i++){
for(j=0;j<M;j++){
if(a[j]==i){
l[i]=l[i]+1;
}
}
}
for(i=0;i<=11;i++){
for(i=1;j<M;i++){
if(a[j]==i){
up[i]=up[i]+1;
}
}
}
for(i=1;i<=11;i++){
pup=pup+up[i]/2;
sp=sp+up[i]%2;
}
pup=pup+sp/4;
printf("%d¥n",pup);
return 0;
}
yn