結果
| 問題 |
No.8061 uxs hxixtya pyuyn ixc hyixa kxuyn
|
| コンテスト | |
| ユーザー |
やむなく
|
| 提出日時 | 2020-04-01 21:44:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,148 bytes |
| コンパイル時間 | 1,827 ms |
| コンパイル使用メモリ | 176,268 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-27 10:14:48 |
| 合計ジャッジ時間 | 2,565 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 16 WA * 3 |
ソースコード
//
// Created by yamunaku on 2020/04/01.
//
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"NO"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)
using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;
int main(){
//CFS;
string s;
getline(cin, s);
int n = s.size();
map<int, int> a, b;
int tt = 0;
rep(i, n){
if(s[i] != ' ') tt++;
if(i & 1){
if(s[i] != ' '){
a[s[i] - 'a'] = true;
}
}else{
if(s[i] != ' '){
b[s[i] - 'a'] = true;
}
}
}
string t = s;
int x = tt, y = tt;
rep(i, n){
if(a[s[i] - 'a'] && s[i] != ' ') s[i] = ' ', x--;
if(b[t[i] - 'a'] && t[i] != ' ') t[i] = ' ', y--;
}
bool ok1 = true, ok2 = true;
if(x == 0) ok1 = false;
if(y == 0) ok2 = false;
int sta1 = 0, sta2 = 0;
rep(i, n){
if(i & 1){
if(t[i] != ' '){
if(sta2 == 2){
ok2 = false;
}
sta2 = 1;
}else{
if(sta2 == 0) sta2 = 2;
}
}else{
if(s[i] != ' '){
if(sta1 == 2){
ok1 = false;
}
sta1 = 1;
}else{
if(sta1 == 0) sta1 = 2;
}
}
}
if(ok1 || ok2) CYES;
else
CNO;
return 0;
}
やむなく