結果

問題 No.548 国士無双
ユーザー mosmos_21mosmos_21
提出日時 2017-11-21 11:21:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,861 bytes
コンパイル時間 1,342 ms
コンパイル使用メモリ 167,764 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-17 13:48:31
合計ジャッジ時間 2,016 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:62:34: warning: 'two' may be used uninitialized [-Wmaybe-uninitialized]
   62 |         FOR(c, 'a', 'm'+1) if(c!=two){
      |                                  ^~~
main.cpp:49:22: note: 'two' was declared here
   49 |     char one = '\0', two;
      |                      ^~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define MOD 1000000007
#define INF  2000000000
//#define int ll
#define ll long long
#define ld long double
#define vi vector<int>
#define p pair<int, int>
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC(type, c, n) vector<type> c(n);for(auto& i:c)cin>>i;
#define MAT(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;

#define BR cout << "\n";
#define SP cout << " ";
#define ENDL cout<<endl;
#define OUT(d) cout<<d;
#define OUTL(d) cout<<d; BR;
#define YES OUTL("YES")
#define Yes OUTL("Yes")
#define NO OUTL("NO")
#define No OUTL("No")
#define RET return 0;
#define SUM(a, n) accumulate(a, a+n, 0)
#define VSUM(v) accumulate(ALL(v), 0);

#define REP(i, n) for(int i=0;i<(n);i++)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define FOR(i, m, n) for(int i = m;i < n; i++)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define AREP(a, n) for(auto (a):(n))
#define ALL(a) (a).begin(),(a).end()
#define IN(n, a, b) ((a)<=(n)&&(n)<(b))

signed main(){ INIT;
    VAR(string, s);
    AREP(c, s)if(!IN(c, 'a', 'o')){
        OUTL("Impossible"); RET;
    }
    char one = '\0', two;
    FOR(c, 'a', 'm'+1){
        int cnt = 0;
        AREP(a,s)if(a==c)cnt++;
        if(cnt==0)one=c;
        if(cnt==2)two=c;
        if(cnt>2){
            OUTL("Impossible"); RET;
        }
    }
    if(one!='\0'){
        OUTL(one);
    }else{
        FOR(c, 'a', 'm'+1) if(c!=two){
            OUTL((char)c);
        }
    }
RET;}
0