結果

問題 No.182 新規性の虜
ユーザー zxc
提出日時 2016-01-18 06:28:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 589 bytes
コンパイル時間 552 ms
コンパイル使用メモリ 59,960 KB
実行使用メモリ 13,888 KB
最終ジャッジ日時 2024-09-19 20:24:21
合計ジャッジ時間 9,704 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 TLE * 1 -- * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
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