Submission #151410

# Submission time Handle Problem Language Result Execution time Memory
151410 2019-09-02T18:22:26 Z phillip Zamjena (COCI18_zamjena) C++14
42 / 70
115 ms 8824 KB
#include <bits/stdc++.h>

using namespace std;
map<string,int>m;
void mapit(string s)
{
    if(s.size()<=3)
    {
        int x=0,ml=1;
        for(int i=s.size()-1;i>=0;i--)
        {
            if(s[i]-'0'>9)
            {
                m[s]=-1;
                return;
            }
            x+=(s[i]-'0')*ml;
            ml*=10;
        }
        m[s]=x;
    }
    else m[s]=-1;
}
string s[100009],s2[100009];
int n;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
        mapit(s[i]);
      //  cout<<m[s[i]]<<" ";
    }
    //cout<<"\n";
    for(int i=0;i<n;i++)
    {
        cin>>s2[i];
        mapit(s2[i]);
        //cout<<m[s2[i]]<<" ";
    }
   // cout<<"\n";
    for(int i=0;i<n;i++)
    {
        if(m[s[i]]==-1&&m[s2[i]]==-1)continue;
        else if(m[s[i]]!=-1&&m[s2[i]]!=-1&&m[s[i]]!=m[s2[i]]){cout<<"NE";/*1 "<<i<<" "<<m[s[i]]<<" "<<m[s2[i]]*/;return 0;}
        m[s[i]]=max(m[s[i]],m[s2[i]]);
        m[s2[i]]=max(m[s[i]],m[s2[i]]);
    }
    for(int i=0;i<n;i++)
    {
        if(m[s[i]]==-1&&m[s2[i]]==-1)continue;
        else if(m[s[i]]!=-1&&m[s2[i]]!=-1&&m[s[i]]!=m[s2[i]]){cout<<"NE";return 0;}
        m[s[i]]=max(m[s[i]],m[s2[i]]);
        m[s2[i]]=max(m[s[i]],m[s2[i]]);
    }
    cout<<"DA";
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 6520 KB Output is correct
2 Correct 7 ms 6648 KB Output is correct
3 Correct 7 ms 6520 KB Output is correct
4 Correct 7 ms 6520 KB Output is correct
5 Correct 7 ms 6648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 6520 KB Output is correct
2 Correct 7 ms 6520 KB Output is correct
3 Correct 7 ms 6648 KB Output is correct
4 Correct 7 ms 6648 KB Output is correct
5 Correct 7 ms 6520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 6648 KB Output is correct
2 Correct 7 ms 6648 KB Output is correct
3 Correct 7 ms 6520 KB Output is correct
4 Correct 7 ms 6648 KB Output is correct
5 Correct 8 ms 6660 KB Output is correct
6 Incorrect 7 ms 6520 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 6648 KB Output is correct
2 Correct 10 ms 6652 KB Output is correct
3 Correct 16 ms 6768 KB Output is correct
4 Correct 15 ms 6776 KB Output is correct
5 Correct 23 ms 6776 KB Output is correct
6 Correct 14 ms 6776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 7156 KB Output is correct
2 Correct 107 ms 7804 KB Output is correct
3 Incorrect 115 ms 8824 KB Output isn't correct
4 Halted 0 ms 0 KB -