結果
| 問題 | No.29 パワーアップ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-11-16 19:04:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 273 bytes |
| 記録 | |
| コンパイル時間 | 465 ms |
| コンパイル使用メモリ | 49,296 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-10-24 20:50:34 |
| 合計ジャッジ時間 | 1,228 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | for(scanf("%d",&n);i<3*n;i++)scanf("%d",&x),se[x]++;
| ~~~~~^~~~~~~~~
main.cpp:6:43: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | for(scanf("%d",&n);i<3*n;i++)scanf("%d",&x),se[x]++;
| ~~~~~^~~~~~~~~
ソースコード
#include <map>
#include <cstdio>
int main(){
std::map<int,int>se;
int i=0,n,x,c=0,r=0;
for(scanf("%d",&n);i<3*n;i++)scanf("%d",&x),se[x]++;
for(std::map<int,int>::iterator it=se.begin();it!=se.end();++it)r+=it->second/2,c+=it->second%2;
printf("%d\n",r+c/4);
}