結果
| 問題 | No.3798 algo to goal |
| ユーザー |
Rubikun
|
| 提出日時 | 2026-11-13 22:43:51 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 77 ms / 2,000 ms |
| + 801µs | |
| コード長 | 1,922 bytes |
| 記録 | |
| コンパイル時間 | 1,566 ms |
| コンパイル使用メモリ | 222,492 KB |
| 実行使用メモリ | 9,748 KB |
| 最終ジャッジ日時 | 2026-11-13 22:43:58 |
| 合計ジャッジ時間 | 6,298 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 40 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define vvii vector<vector<pair<int,int>>>
#define vvll vector<vector<pair<ll,ll>>>
#define vst vector<string>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define mkunique(x) sort(all(x));(x).erase(unique(all(x)),(x).end())
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=15<<26;
bool solve(string S,string T){
ll N=si(S);
vi X;
for(int q=0;q<2;q++){
string A,B;
for(int i=0;i<N;i++){
if((i&1)==q){
A+=S[i];
B+=T[i];
}
}
string AA=A,BB=B;
sort(all(AA));
sort(all(BB));
if(AA!=BB) return false;
if(si(A)>26) X.pb(3);
else{
int ten=0,tyou=0;
for(int i=0;i<si(A);i++){
for(int j=i+1;j<si(A);j++){
if(A[i]>A[j]) ten^=1;
if(B[i]>B[j]) ten^=1;
if(A[i]==A[j]) tyou=true;
}
}
if(tyou) X.pb(3);
else X.pb(1<<ten);
}
}
if((X[0]&X[1])>0) return true;
else return false;
}
int main(){
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
int Q;cin>>Q;
while(Q--){
string S,T;cin>>S>>T;
if(solve(S,T)) cout<<"Yes\n";
else cout<<"No\n";
}
}
Rubikun