이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
bool is_str(string s){
if(s[0] - '0' > 9){
return true;
}
return false;
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n; cin >> n;
vector<string> v1(n);
map<string, string> mp;
for(int i = 0; i < n; i++){
cin >> v1[i];
mp[v1[i]] = "-1";
}
vector<string> v2(n);
for(int i = 0; i < n; i++){
cin >> v2[i];
mp[v2[i]] = "-1";
}
for(int i = 0; i < n; i++){
if(is_str(v1[i]) && !is_str(v2[i])){
v1[i] = v2[i];
mp[v1[i]] = v2[i];
}
if(!is_str(v1[i]) && is_str(v2[i])){
v2[i] = v1[i];
mp[v2[i]] = v1[i];
}
}
for(int i = 0; i < n; i++){
if(mp[v1[i]] != "-1"){
v1[i] = mp[v1[i]];
}
}
for(int i = 0; i < n; i++){
if(mp[v2[i]] != "-1"){
v2[i] = mp[v2[i]];
}
}
for(int i = 0; i < n; i++){
if(is_str(v1[i]) && is_str(v2[i])){
v1[i] = "1";
v2[i] = "1";
}
}
for(int i = 0; i < n; i++){
if(v1[i] != v2[i]){
cout << "NE" <<"\n";
return 0;
}
}
/*
for(int i = 0; i < n; i++){
cout << v1[i] <<" ";
}
cout <<"\n";
for(int i = 0; i < n; i++){
cout << v2[i] <<" ";
}
cout <<"\n";
*/
cout << "DA" <<"\n";
/*
3
3 1 2
3 1 x
4
4 5 iks ipsilon
1 iks 3 iks
5
x 3 x y 3
x y 2 z 3
*/
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |