답안 #472418

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472418 2021-09-13T14:04:07 Z Ahmed_Solyman Zamjena (COCI18_zamjena) C++14
28 / 70
58 ms 4976 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

bool isNum(string s){
    bool b=1;
    for(char c:s){
        b&=isdigit(c);
    }
    return b;
}
int main()
{
    ll n;cin>>n;
    vector<string>a(n),b(n);
    for(auto &i:a)cin>>i;
    for(auto &i:b)cin>>i;
    bool v=1;
    map<string,string>mp;
    map<string,bool>vis,t;
    map<string,string>u;
    for(ll i=0;i<n;i++){
        if(isNum(a[i]) && !isNum(b[i])){
            mp[b[i]]=a[i];
        }
        else if(!isNum(a[i]) && isNum(b[i])){
            mp[a[i]]=b[i];
        }
    }
    for(ll i=0;i<n;i++){
        if(isNum(a[i]) && isNum(b[i])){
            v&=(a[i]==b[i]);
        }
        else if(isNum(a[i])){
            if(mp[b[i]].empty()){
                mp[b[i]]=a[i];
            }
            v&=(a[i]==mp[b[i]]);
        }
        else if(isNum(b[i])){
            if(mp[a[i]].empty()){
                mp[a[i]]=b[i];
            }
            v&=(mp[a[i]]==b[i]);
        }
        else{
            if(mp[a[i]].empty()){
                mp[a[i]]=mp[b[i]];
            }
            else if(mp[b[i]].empty()){
                mp[b[i]]=mp[a[i]];
            }
            v&=(mp[a[i]]==mp[b[i]]);
        }
    }
    if(v){
        cout<<"DA";
    }
    else{
        cout<<"NE";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 7 ms 716 KB Output is correct
4 Incorrect 5 ms 716 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 1596 KB Output is correct
2 Correct 32 ms 3108 KB Output is correct
3 Incorrect 58 ms 4976 KB Output isn't correct
4 Halted 0 ms 0 KB -