結果
| 問題 | No.29 パワーアップ | 
| コンテスト | |
| ユーザー |  t_murano | 
| 提出日時 | 2014-11-25 18:04:28 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 483 bytes | 
| コンパイル時間 | 515 ms | 
| コンパイル使用メモリ | 64,992 KB | 
| 実行使用メモリ | 7,720 KB | 
| 最終ジャッジ日時 | 2025-10-24 20:50:45 | 
| 合計ジャッジ時間 | 1,402 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 22 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:21:12: warning: ‘up’ is used uninitialized [-Wuninitialized]
   21 |         up += items[i] / 2;
      |         ~~~^~~~~~~~~~~~~~~
main.cpp:12:9: note: ‘up’ was declared here
   12 |     int up, tmp;
      |         ^~
main.cpp:22:13: warning: ‘tmp’ is used uninitialized [-Wuninitialized]
   22 |         tmp += items[i] % 2;
      |         ~~~~^~~~~~~~~~~~~~~
main.cpp:12:13: note: ‘tmp’ was declared here
   12 |     int up, tmp;
      |             ^~~
            
            ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int items[11];
int main() {
    int n;
    int a, b, c;
    int up, tmp;
    cin >> n;
    REP(i, n) {
        cin >> a >> b >> c;
        items[a]++;
        items[b]++;
        items[c]++;
    }
    REP(i, 11) {
        up += items[i] / 2;
        tmp += items[i] % 2;
    }
    up += tmp / 4;
    cout << up << endl;
    return 0;
}
            
            
            
        