結果
| 問題 | No.2629 A replace B replace C |
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2024-02-17 01:18:27 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 589 bytes |
| 記録 | |
| コンパイル時間 | 1,715 ms |
| コンパイル使用メモリ | 210,288 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-07-03 16:58:17 |
| 合計ジャッジ時間 | 3,294 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 61 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
cin>>n;
string s,t;
cin>>s>>t;
int ab=0,bc=0;
rep(i,n){
if(s[i]>t[i]){
cout<<"No\n";
return 0;
}
if(s[i]=='A' && t[i]=='B') ab++;
else if(s[i]=='B' && t[i]=='C') bc++;
}
if(ab==bc && ab==0){
if(s==t) cout<<"Yes\n";
else cout<<"No\n";
}
else if(ab==bc) cout<<"Yes\n";
else cout<<"No\n";
return 0;
}
umezo