結果

問題 No.182 新規性の虜
ユーザー zxczxc
提出日時 2016-01-18 06:25:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3,619 ms / 5,000 ms
コード長 543 bytes
コンパイル時間 798 ms
コンパイル使用メモリ 63,468 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 09:15:16
合計ジャッジ時間 24,071 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 960 ms
4,384 KB
testcase_09 AC 2,567 ms
4,384 KB
testcase_10 AC 1,925 ms
4,384 KB
testcase_11 AC 1,311 ms
4,380 KB
testcase_12 AC 238 ms
4,384 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 860 ms
4,384 KB
testcase_19 AC 554 ms
4,380 KB
testcase_20 AC 266 ms
4,380 KB
testcase_21 AC 1,013 ms
4,380 KB
testcase_22 AC 384 ms
4,384 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 3,619 ms
4,380 KB
testcase_25 AC 8 ms
4,380 KB
testcase_26 AC 44 ms
4,384 KB
testcase_27 AC 2 ms
4,380 KB
evil01.txt AC 3,635 ms
4,380 KB
evil02.txt AC 3,628 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:18: warning: ‘s’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   for(size_t s; s<N-1;s++){
                 ~^~~~

ソースコード

diff #

#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>

int main(){
  std::cout.sync_with_stdio(false);
  std::vector<int> vc;
  size_t N;
  std::cin >> N;
  vc.reserve(N);
  int temp;
  std::cin>>temp;
  vc.push_back(temp);
  
  size_t cnt{1};
  for(size_t s; s<N-1;s++){
    std::cin>>temp;
    size_t a = count(std::begin(vc),std::end(vc),temp);
    if(a == 0){    
        vc.push_back(temp);  
        cnt++;
    }
    if(1 == a){
        vc.push_back(temp);
        cnt--;
    }
  }
  std::cout<<cnt<<std::endl;
}
0