結果
問題 | No.197 手品 |
ユーザー |
![]() |
提出日時 | 2015-05-06 06:13:43 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,472 bytes |
コンパイル時間 | 1,393 ms |
コンパイル使用メモリ | 159,116 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 09:36:00 |
合計ジャッジ時間 | 2,733 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 38 WA * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:65:52: warning: ‘a’ may be used uninitialized in this function [-Wmaybe-uninitialized] 65 | cout << (n < 2 && ((b == a && n == 1) || abs(a - b) > n) ? "SUCCESS" : "FAILURE") << endl; | ~~^~~ main.cpp:65:52: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ソースコード
#include <bits/stdc++.h> using namespace std; #define LOG(...) fprintf(stderr,__VA_ARGS__) //#define LOG(...) #define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i) #define REP(i,n) for(int i=0;i<(int)(n);++i) #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort(ALL(c)) #define RSORT(c) sort(RALL(c)) typedef long long ll; typedef unsigned long long ull; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vb> vvb; typedef vector<vi> vvi; typedef vector<vll> vvll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; int main() { string sb, sa; int n; cin >> sb >> n >> sa; int ob = 0, xb = 0; int oa = 0, xa = 0; REP(i, 3) { if (sb[i] == 'o') { ob++; } else { xb++; } if (sa[i] == 'o') { oa++; } else { xa++; } } if (ob != oa || xb != xa) { cout << "SUCCESS" << endl; return 0; } // xox xox -> 1 // oxx xox -> 0 // oxx xxo -> 0 1 int b, a; REP(i, 3) { if (ob < xb) { if (sb[i] == 'o') b = i; if (sa[i] == 'o') a = i; } if (ob > xb) { if (sb[i] == 'x') b = i; if (sa[i] == 'x') a = i; } } cout << (n < 2 && ((b == a && n == 1) || abs(a - b) > n) ? "SUCCESS" : "FAILURE") << endl; }