結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
IL_msta
|
| 提出日時 | 2015-06-15 04:54:36 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,863 bytes |
| コンパイル時間 | 856 ms |
| コンパイル使用メモリ | 85,208 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-20 03:41:30 |
| 合計ジャッジ時間 | 1,785 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 43 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:109:25: warning: ‘B’ may be used uninitialized in this function [-Wmaybe-uninitialized]
109 | if(B==1){
| ^~
main.cpp:122:22: warning: ‘A’ may be used uninitialized in this function [-Wmaybe-uninitialized]
122 | else if(A==2){
| ^~
main.cpp:87:17: warning: ‘aftT’ may be used uninitialized in this function [-Wmaybe-uninitialized]
87 | if(befT == aftT){
| ^~
main.cpp:87:17: warning: ‘befT’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ソースコード
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <list>
#include <queue>
#include <vector>
#include <complex>
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) std::cout<<(p)<<std::endl;
/////////
typedef long long LL;
typedef long double LD;
/////////
using namespace::std;
/////////
int main(void){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed;//
//cout << setprecision(6);//
string befS,aftS;
int N;//[2 000 000 000]
cin>>befS>>N>>aftS;
int bef[3],aft[3];
int befC=0,aftC=0;//oの数
rep(i,3){
if(befS[i]=='o'){
bef[i] = 1;
++befC;
}else{
bef[i] = 0;
}
if(aftS[i]=='o'){
aft[i] = 1;
++aftC;
}else{
aft[i] = 0;
}
}
if( (befC == 0 && aftC==0) || (befC == 3 &&aftC==3)){
P("FAILURE");
return 0;
}
else if( befC != aftC){
P("SUCCESS");
return 0;
}
int befT,aftT;
if(befC == 1){
rep(i,3){
if(befS[i] == 'o'){
befT = i;
}
}
rep(i,3){
if(aftS[i] == 'o'){
aftT = i;
}
}
}
else if(befC == 2){
rep(i,3){
if(befS[i] == 'x'){
befT = i;
}
}
rep(i,3){
if(aftS[i] == 'x'){
aftT = i;
}
}
}
//befT,aftT /0,1,2
if(N==0){
if(befT == aftT){
P("FAILURE");
}else{
P("SUCCESS");
}
}
else if(N==1){
int A,B;
if(befC == 1){
rep(i,3){
if(bef[i]==1)A=i;
if(aft[i]==1)B=i;
}
}
else if(befC == 2){
rep(i,3){
if(bef[i]==0)A=i;
if(aft[i]==0)B=i;
}
}
if(A==1){
if(B==1){
P("SUCCESS");
}else{
P("FAILURE");
}
}
else if( A==0){
if(B==2){
P("SUCCESS");
}else{
P("FAILURE");
}
}
else if(A==2){
if(B==0){
P("SUCCESS");
}else{
P("FAILURE");
}
}
}
else{
P("FAILURE");
}
return 0;
}
IL_msta