結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
n_vip
|
| 提出日時 | 2015-04-29 00:16:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,717 bytes |
| コンパイル時間 | 716 ms |
| コンパイル使用メモリ | 94,424 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 08:07:39 |
| 合計ジャッジ時間 | 1,919 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 38 WA * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:66:17: warning: ‘t’ may be used uninitialized in this function [-Wmaybe-uninitialized]
66 | }else if(abs(s-t)==2){
| ~~~^~~~~
main.cpp:65:15: warning: ‘s’ may be used uninitialized in this function [-Wmaybe-uninitialized]
65 | f=(s==1 && n%2);
| ~~~~~~^~~~~~~
ソースコード
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
int main(){
ios_base::sync_with_stdio(false);
cout<<fixed<<setprecision(0);
int i,j,k;
string a,b;
ll n,s,t,f;
cin>>a>>n>>b;
int cnt=0,ct=0;
rep(i,3){
cnt+=(a[i]=='x');
ct+=(b[i]=='x');
}
if(cnt!=ct){
f=1;
}else if(cnt==0 || ct==3){
f=0;
}else{
rep(i,3){
if(cnt==1 && a[i]=='x') s=i;
if(cnt==1 && b[i]=='x') t=i;
if(cnt==2 && a[i]=='o') s=i;
if(cnt==2 && b[i]=='o') t=i;
}
if(s==t){
f=(s==1 && n%2);
}else if(abs(s-t)==2){
f=(n<2);
}else{
f=!n;
}
}
cout<<(f?"SUCCESS":"FAILURE")<<endl;
return 0;
}
n_vip