結果
問題 | No.3061 uxs hxixtya pyuyn ixc hyixa kxuyn |
ユーザー | やむなく |
提出日時 | 2020-04-01 21:45:12 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 2,201 bytes |
コンパイル時間 | 1,607 ms |
コンパイル使用メモリ | 175,476 KB |
実行使用メモリ | 6,548 KB |
最終ジャッジ日時 | 2023-12-30 17:29:45 |
合計ジャッジ時間 | 2,581 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,548 KB |
testcase_01 | AC | 1 ms
6,548 KB |
testcase_02 | AC | 1 ms
6,548 KB |
testcase_03 | AC | 1 ms
6,548 KB |
testcase_04 | AC | 2 ms
6,548 KB |
testcase_05 | AC | 1 ms
6,548 KB |
testcase_06 | AC | 2 ms
6,548 KB |
testcase_07 | AC | 2 ms
6,548 KB |
testcase_08 | AC | 1 ms
6,548 KB |
testcase_09 | AC | 2 ms
6,548 KB |
testcase_10 | AC | 2 ms
6,548 KB |
testcase_11 | AC | 2 ms
6,548 KB |
testcase_12 | AC | 2 ms
6,548 KB |
testcase_13 | AC | 2 ms
6,548 KB |
testcase_14 | AC | 2 ms
6,548 KB |
testcase_15 | AC | 1 ms
6,548 KB |
testcase_16 | AC | 2 ms
6,548 KB |
testcase_17 | AC | 1 ms
6,548 KB |
testcase_18 | AC | 1 ms
6,548 KB |
testcase_19 | AC | 2 ms
6,548 KB |
testcase_20 | AC | 2 ms
6,548 KB |
testcase_21 | AC | 1 ms
6,548 KB |
testcase_22 | AC | 2 ms
6,548 KB |
testcase_23 | AC | 1 ms
6,548 KB |
ソースコード
// // 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(); if(n == 1){ CNO; return 0; } 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; }