답안 #464617

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
464617 2021-08-13T14:24:08 Z ahmedfouadnew Zamjena (COCI18_zamjena) C++17
14 / 70
3 ms 1100 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
const int mod=1e9+7;
map<string,string>mp;
int n;
string s[5001];
string s2[5001];
signed main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<n;i++)
    {
        cin>>s2[i];
    }
    for(int i=0;i<n;i++)
    {
      bool isv=(s[i][0]<='z'&&s[i][0]>='a');
      bool isv2=(s2[i][0]<='z'&&s2[i][0]>='a');
      if(isv&&isv2)
      {
          s[i]=mp[s[i]];
          s2[i]=mp[s2[i]];
          if(s[i]==""||s2[i]=="") continue;
          if(s[i]!=s2[i])
          {
              puts("NE");
              return 0;
          }
          continue;
      }
      if(isv)
      {
          if(mp[s[i]]!=""&&mp[s[i]]!=s2[i])
          {
              puts("NE");
              return 0;
          }
          if(mp[s[i]]=="") mp[s[i]]=s2[i];
          continue;
      }
      if(isv2)
      {
          if(mp[s2[i]]!=""&&mp[s2[i]]!=s[i])
          {
              puts("NE");
              return 0;
          }
          if(mp[s2[i]]=="") mp[s2[i]]=s[i];
          continue;
      }
      if(s[i]!=s2[i])
      {
          puts("NE");
          return 0;
      }
    }
    puts("DA");
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 1 ms 588 KB Output is correct
3 Correct 1 ms 588 KB Output is correct
4 Correct 1 ms 588 KB Output is correct
5 Correct 1 ms 588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 588 KB Output is correct
2 Incorrect 1 ms 612 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 588 KB Output is correct
2 Correct 1 ms 588 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Incorrect 1 ms 588 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 612 KB Output is correct
2 Correct 1 ms 588 KB Output is correct
3 Incorrect 3 ms 844 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 1100 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -