結果

問題 No.313 π
コンテスト
ユーザー どらら
提出日時 2016-05-15 00:51:35
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,090 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 981 ms
コンパイル使用メモリ 108,792 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-21 15:04:09
合計ジャッジ時間 2,137 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
                 from main.cpp:6:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
    inlined from 'int main()' at main.cpp:51:26:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'ret1' may be used uninitialized [-Wmaybe-uninitialized]
  212 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:42:6: note: 'ret1' was declared here
   42 |   ll ret1, ret2;
      |      ^~~~
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
    inlined from 'int main()' at main.cpp:51:11:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'ret2' may be used uninitialized [-Wmaybe-uninitialized]
  212 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:42:12: note: 'ret2' was declared here
   42 |   ll ret1, ret2;
      |            ^~~~

ソースコード

diff #
raw source code

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  map<char,int> memo, memo2;
  memo['0'] = 20104;
  memo['1'] = 20063;
  memo['2'] = 19892;
  memo['3'] = 20011;
  memo['4'] = 19874;
  memo['5'] = 20199;
  memo['6'] = 19898;
  memo['7'] = 20163;
  memo['8'] = 19956;
  memo['9'] = 19841;

  string S;
  cin >> S;
  rep(i,S.length()){
    memo2[S[i]]++;
  }
  ll ret1, ret2;
  FOR(it,memo){
    if(memo2[it->first] > it->second){
      ret1 = it->first;
    }
    if(memo2[it->first] < it->second){
      ret2 = it->first;
    }
  }
  cout << ret2 << " " << ret1 << endl;
  return 0;
}
0