結果

問題 No.182 新規性の虜
ユーザー zxczxc
提出日時 2016-01-18 06:28:33
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 589 bytes
コンパイル時間 486 ms
コンパイル使用メモリ 60,852 KB
実行使用メモリ 10,056 KB
最終ジャッジ日時 2023-10-20 00:35:10
合計ジャッジ時間 10,114 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <iterator>
#include <algorithm>
//#include <vector>
#include<list>
int main(){
  std::cout.sync_with_stdio(false);
    
  //std::vector<int> vc;
  std::list<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(0 == a){    
        vc.push_back(temp);  
        cnt++;
    }
    if(1 == a){
        vc.push_back(temp);
        cnt--;
    }
  }
  std::cout<<cnt<<std::endl;
}
0