답안 #472213

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472213 2021-09-13T09:28:28 Z BidoTeima Zamjena (COCI18_zamjena) C++17
28 / 70
47 ms 4756 KB
/// isA AC
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void ACPLS(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define tc int tttttt;cin>>tttttt;while(tttttt--)
#define sumrange(l,r,arr) (l==0?arr[r]:arr[r]-arr[l-1])
bool isint(string& s){
    bool ok=1;
    for(char i:s)
        ok&=isdigit(i);
    return ok;
}
bool isseq(string& s){
    return !isint(s);
}
int main(){
    ACPLS();
    int n;
    cin>>n;
    string a[n],b[n];
    for(auto&i:a)cin>>i;
    for(auto&i:b)cin>>i;
    map<string,string>mp{};
    for(int i = 0; i < n; i++){
        if(isint(b[i])&&isseq(a[i])){
            mp[a[i]]=b[i];
        }
        else if(isint(a[i])&&isseq(b[i])){
            mp[b[i]]=a[i];
        }
    }
    bool ok = 1;
    for(int i = 0; i < n; i++){
        if(isint(a[i])&&isint(b[i])){
            ok&=a[i]==b[i];
        }
        else if(isint(a[i])&&isseq(b[i])){
            if(mp[b[i]].empty())
                mp[b[i]]=a[i];
            ok&=mp[b[i]]==a[i];
        }
        else if(isint(b[i])&&isseq(a[i])){
            if(mp[a[i]].empty())
                mp[a[i]]=b[i];
            ok&=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]];
            }
            ok&=mp[a[i]]==mp[b[i]];
        }
    }
    cout<<(ok?"DA":"NE");
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 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 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 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 0 ms 204 KB Output is correct
3 Correct 0 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 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 5 ms 716 KB Output is correct
4 Incorrect 4 ms 716 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 1484 KB Output is correct
2 Correct 27 ms 2968 KB Output is correct
3 Incorrect 47 ms 4756 KB Output isn't correct
4 Halted 0 ms 0 KB -