結果
| 問題 | No.29 パワーアップ |
| コンテスト | |
| ユーザー |
yn
|
| 提出日時 | 2014-11-25 18:58:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 502 bytes |
| 記録 | |
| コンパイル時間 | 511 ms |
| コンパイル使用メモリ | 30,344 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-10-24 20:51:10 |
| 合計ジャッジ時間 | 1,129 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d",&N);
| ~~~~~^~~~~~~~~
main.cpp:25:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
25 | scanf("%d",&a[i]);
| ~~~~~^~~~~~~~~~~~
main.cpp:17:21: warning: iteration 301 invokes undefined behavior [-Waggressive-loop-optimizations]
17 | a[i]=0;
| ~~~~^~
main.cpp:16:18: note: within this loop
16 | for(i=0;i<=301;i++){
| ~^~~~~
main.cpp:21:22: warning: iteration 11 invokes undefined behavior [-Waggressive-loop-optimizations]
21 | up[i]=0;
| ~~~~~^~
main.cpp:20:18: note: within this loop
20 | for(i=0;i<=11;i++){
| ~^~~~
main.cpp:17:21: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’ writing 1208 bytes into a region of size 1204 overflows the destination [-Wstringop-overflow=]
17 | a[i]=0;
| ~~~~^~
main.cpp:7:13: note: destination object ‘a’ of size 1204
7 | int a[301];
| ^
main.cpp:21:22: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’ writing 48 bytes into a region of size 44 overflows the destination [-Wstringop-overflow=]
21 | up[i]=0;
| ~~~~~^~
main.cpp:8:13: note: destination object ‘up’ of size 44
8 | int up[11];
| ^~
ソースコード
#include<stdio.h>
int main(){
int N=0,M=0;
int i=0,j=0;
int pup=0;
int a[301];
int up[11];
int sp=0;
scanf("%d",&N);
M=N*3;
for(i=0;i<=301;i++){
a[i]=0;
}
for(i=0;i<=11;i++){
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){
up[i]=up[i]+1;
}
}
}
for(i=1;i<=10;i++){
pup=pup+up[i]/2;
sp=sp+up[i]%2;
}
pup=pup+sp/4;
printf("%d\n",pup);
return 0;
}
yn